Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Excel PageSeup Zoom Factor

Status
Not open for further replies.

Hmadyson

Programmer
Mar 14, 2001
202
US
I would like to add page breaks to a sheet in Excel VBA. What I would like to do is set the pagesetup to fitonepagewide, then figure out what the zoom factor should be and set the zoom factor, and then add the pagebreaks. Unfortunately I cannot figure out what the zoom factor is. Does anyone know how to do this in a macro. Manually it seems pretty easy because the zoom factor is calculated and displayed on the pagesetup dialog.
 
I don't want to zoom on the window, I want the zoom on the pagesetup, which is false if you set fittopageswide or fittopagestall.
 
I hope the following helps...

Sub Set_ZoomFactor()
With ActiveSheet.PageSetup
.FitToPagesWide = 1
End With
zoomfactor = ActiveSheet.PageSetup.Zoom
ActiveSheet.PageSetup.Zoom = zoomfactor
End Sub

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top