NMiller007
Programmer
I am using an Access macro to export data to multiple Excel worksheets. I have all of the data going to Excel and most of the formatting working.
Now I need to set the Page Setup options for all of these worksheets. I am zooming to 90%, adding a footer, changing margins, and repeating rows at the top. Here is the code I am using:
This is only doing the page setup for the first worksheet in the list. Am I missing something?
I tried doing the page setup portion for each worksheet as I was creating it, but that seemed really slow and somehow the macro finished without even starting to format the last few worksheets (maybe a memory issue?). I also tried using a Sheet Array instead of .Sheets.Select and that only setup the first sheet as well.
Thanks!
Now I need to set the Page Setup options for all of these worksheets. I am zooming to 90%, adding a footer, changing margins, and repeating rows at the top. Here is the code I am using:
Code:
.Sheets.Select
With .ActiveSheet.PageSetup
.PrintTitleRows = "$1:$14"
.CenterHeader = ""
.CenterFooter = "Page &P of &N"
.LeftMargin = 36
.RightMargin = 36
.TopMargin = 36
.BottomMargin = 36
.CenterHorizontally = True
.Zoom = 90
End With
This is only doing the page setup for the first worksheet in the list. Am I missing something?
I tried doing the page setup portion for each worksheet as I was creating it, but that seemed really slow and somehow the macro finished without even starting to format the last few worksheets (maybe a memory issue?). I also tried using a Sheet Array instead of .Sheets.Select and that only setup the first sheet as well.
Thanks!