I am creating a Visual Basic 6 project to copy data out of an Access file and put it in a new Excel 2010 file.
I've gotten my data extracted properly from my Access file but I'm trying to format the Page Layout my new Excel 2010 file from within my Visual Basic 6 project.
Several of my Page Layout modifications have worked fine but setting the "Orientation" to 'Landscape' has not worked so far. Either I get errors at runtime or it just doesn't change the Page Layout, "Orientation" to 'Landscape'.
So far, I used the below code to change some layout settings and they work fine:
sheet.PageSetup.CenterHeader = _
"&""Times New Roman,Bold""&12My Company" & Chr(10) & "Report"
sheet.PageSetup.RightHeader = "&""Times New Roman,Bold""&12&D &T"
sheet.PageSetup.CenterFooter = "&""Times New Roman,Bold""&12Page &P of &N"
sheet.PageSetup.PrintGridlines = True
NOTE: "sheet" is 'Set sheet = book.Worksheets(1)'
If I add the below line after the 'PrintGridLines' statement shown above, it runs without error but the "Orientation" does not get changed and none of the 'Layout' changes show above get changed?:
sheet.PageSetup.Orientation = xlLandscape
Any help would be greatly appreciated.
Thanks in advance.