View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Caroline Bolce-Gormley Caroline Bolce-Gormley is offline
external usenet poster
 
Posts: 1
Default Set Excel margins from MS Project

I'm writing a macro from MS Project that changes Excel PageSetup prior
to exporting data to it. All of my PageSetup commands are working
except the ones to change margins. Can anyone tell me why, please?

'Set up Excel page header and footer, orientation, margins, and titles
With xlBook.Worksheets(1).PageSetup
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
.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

Thanks,
Caroline