ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Excel margins from MS Project (https://www.excelbanter.com/excel-programming/292611-set-excel-margins-ms-project.html)

Caroline Bolce-Gormley

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


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com