In my macro, I am using the following code to change the Excel PageSetup from a Project macro. However, none of the Margin commands are working, as commented below
'Set up Excel page header and footer, orientation, margins, and titles
With xlBook.Worksheets(1).PageSetup
.LeftMargin = Application.InchesToPoints(0.5) 'does not work
.RightMargin = Application.InchesToPoints(0.5) 'does not work
.TopMargin = Application.InchesToPoints(0.5) 'does not work
.BottomMargin = Application.InchesToPoints(0.5) 'does not work
.HeaderMargin = Application.InchesToPoints(0.25) 'does not work
.FooterMargin = Application.InchesToPoints(0.25) 'does not work
.RightFooter = "&""Arial,Italic""xls1.Name"
.CenterFooter = "&""Arial,Italic""&8Page &P of &N"
.RightFooter = "&""Arial,Italic""&8&D &T"
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.CenterHorizontally = True
.PrintTitleRows = "$1:$5"
.PrintTitleColumns = "A$:E$"
End With
Does anyone know why margins won't reset when everything else does?
Thanks,
Caroline




