Faster page set-up

Popet21

New Member
Joined
Mar 2, 2011
Messages
4
I am trying to speed up page set in VBA and I am using the following code which is erroring out:
Application.ExecuteExcel4Macro ("Page.Setup(""&c&A"","&c "Page &P of &N"",0.75,0.75, 0.75,0.75,FALSE,FALSE,TRUE,FALSE,2,1,"",PAGE_NUMBER,PAGE_ORDER,FALSE,600,0.5,0.5,FALSE,FALSE)")

The original VBA is:
With ActiveSheet.PageSetup<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
.LeftHeader = ""<o:p></o:p>
.CenterHeader = "&A"<o:p></o:p>
.RightHeader = ""<o:p></o:p>
.LeftFooter = ""<o:p></o:p>
.CenterFooter = "Page &P of &N"<o:p></o:p>
.RightFooter = ""<o:p></o:p>
.LeftMargin = Application.InchesToPoints(0.236220472440945)<o:p></o:p>
.RightMargin = Application.InchesToPoints(0.236220472440945)<o:p></o:p>
.TopMargin = Application.InchesToPoints(0.708661417322835)<o:p></o:p>
.BottomMargin = Application.InchesToPoints(0.708661417322835)<o:p></o:p>
.HeaderMargin = Application.InchesToPoints(0.511811023622047)<o:p></o:p>
.FooterMargin = Application.InchesToPoints(0.511811023622047)<o:p></o:p>
.PrintHeadings = False<o:p></o:p>
.PrintGridlines = False<o:p></o:p>
.PrintComments = xlPrintNoComments<o:p></o:p>
.PrintQuality = 600<o:p></o:p>
.CenterHorizontally = False<o:p></o:p>
.CenterVertically = False<o:p></o:p>
.Orientation = xlLandscape<o:p></o:p>
.Draft = False<o:p></o:p>
.PaperSize = xlPaperA4<o:p></o:p>
.FirstPageNumber = xlAutomatic<o:p></o:p>
.Order = xlDownThenOver<o:p></o:p>
.BlackAndWhite = False<o:p></o:p>
.Zoom = False<o:p></o:p>
.FitToPagesWide = 1<o:p></o:p>
.FitToPagesTall = False<o:p></o:p>
.PrintErrors = xlPrintErrorsDisplayed<o:p></o:p>
.OddAndEvenPagesHeaderFooter = False<o:p></o:p>
.DifferentFirstPageHeaderFooter = False<o:p></o:p>
.ScaleWithDocHeaderFooter = True<o:p></o:p>
.AlignMarginsHeaderFooter = True<o:p></o:p>
.EvenPage.LeftHeader.Text = ""<o:p></o:p>
.EvenPage.CenterHeader.Text = ""<o:p></o:p>
.EvenPage.RightHeader.Text = ""<o:p></o:p>
.EvenPage.LeftFooter.Text = ""<o:p></o:p>
.EvenPage.CenterFooter.Text = ""<o:p></o:p>
.EvenPage.RightFooter.Text = ""<o:p></o:p>
.FirstPage.LeftHeader.Text = ""<o:p></o:p>
.FirstPage.CenterHeader.Text = ""<o:p></o:p>
.FirstPage.RightHeader.Text = ""<o:p></o:p>
.FirstPage.LeftFooter.Text = ""<o:p></o:p>
.FirstPage.CenterFooter.Text = ""<o:p></o:p>
.FirstPage.RightFooter.Text = ""<o:p></o:p>
End With<o:p></o:p>
Please help????
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try this:
Code:
Application.ExecuteExcel4Macro ("Page.Setup(""&c&A"",""&c Page &P of &N"",0.75,0.75, 0.75,0.75,FALSE,FALSE,TRUE,FALSE,2,1,,,1,FALSE,600,0.5,0.5,FALSE,FALSE)")
 
Upvote 0
Thanks for this reply - the only thing that didn't work was the fit page to 1 wide by "" tall. Any ideas??

Much appreciated.
 
Upvote 0
Ah, OK, didn't spot that. Try this:
Code:
Application.ExecuteExcel4Macro ("Page.Setup(""&c&A"",""&c Page &P of &N"",0.75,0.75, 0.75,0.75,FALSE,FALSE,TRUE,FALSE,2,1,{1,#N/A},,1,FALSE,600,0.5,0.5,FALSE,FALSE)")
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top