Excel VBA .pagesetup property runs very very slow

  • Thread starter Thread starter Navin
  • Start date Start date
N

Navin

I've written simple VBA macros that include the .pagesetup
property but as the macro is running, it seems to get very
very slow when it reaches the .pagesetup section of the
code.

Has anyone encountered this? It only seems to happen on
certain computers? Any help is greatly appreciated.

Regards,
Navin
 
Hi Navin,

I think it's a built in feature. I sometime wonder what the hell is going on
during all the time that it takes.

Regards,
Don
 
Navin, the secret to speeding up page setup is to check each pagesetup
property and only change it if needed versus resetting it to a new value.
You will get a 20X increase in speed. This does mean a lot of IF
statements, one for each property you want to set.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Navin,
This also helps...

Insert this line before and after accessing PageSetUp.

ActiveSheet.DisplayPageBreaks = False
or use the actual sheet...
Worksheets("MySheet").DisplayPageBreaks = False

Excel does not have to determine where to put page breaks.
It does speed things up.

Regards,
Jim Cone
San Francisco, CA
 
Leave out the properties you don't need to set. Every line with a property
is a separate call to pagesetup and the print driver, so it is slow.
 
Back
Top