D
david.j.winfield
I am trying to change the PageSetup using VBA, but it does not seem to
take the changes. I tried using both the XL4M method and the
standard .PageSetup. I seem to be able to set the print area, but not
the PaperSize or the Orientation. I have stepped through the code and
it does not error out, but the settings do not change in PageSetup
either. The worksheet is not protected.
Here are the two methods that I used (I put the code for PageSetupXL4M
into its own macro).
With Worksheets("Master Index").PageSetup
'With ActiveSheet.PageSetup
'.PrintHeadings = False
.Zoom = False
.Orientation = page_orientation
.CenterHorizontally = False
.CenterVertically = False
.PaperSize = page_size
.FitToPagesWide = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
PageSetupXL4M PrintHeadings:=False, _
Zoom:=False, _
Orientation:=page_orientation, _
CenterHorizontally:=False, _
CenterVertically:=False, _
PaperSize:=page_size
I have tried setting page_orientation to both the string "xlPortrait"
and the number xlPortrait (1).
Thanks for your help,
David
take the changes. I tried using both the XL4M method and the
standard .PageSetup. I seem to be able to set the print area, but not
the PaperSize or the Orientation. I have stepped through the code and
it does not error out, but the settings do not change in PageSetup
either. The worksheet is not protected.
Here are the two methods that I used (I put the code for PageSetupXL4M
into its own macro).
With Worksheets("Master Index").PageSetup
'With ActiveSheet.PageSetup
'.PrintHeadings = False
.Zoom = False
.Orientation = page_orientation
.CenterHorizontally = False
.CenterVertically = False
.PaperSize = page_size
.FitToPagesWide = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
PageSetupXL4M PrintHeadings:=False, _
Zoom:=False, _
Orientation:=page_orientation, _
CenterHorizontally:=False, _
CenterVertically:=False, _
PaperSize:=page_size
I have tried setting page_orientation to both the string "xlPortrait"
and the number xlPortrait (1).
Thanks for your help,
David