If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
PageSetup macro calls are slow
The code below takes nearly 11 seconds to run; this is on a WinXP with
a P4 at 1.2 GHz, 512MB RAM, oceans of free disk space, and Excel 2002. Experiments with various lines commented out show that each line requires an astonishing 1.2 seconds to run, except the last three (.Zoom and the two .FitToPages lines), which execute all but instantaneously. Other open programs, available RAM, all the usual suspects for slow code don't seem to matter here; I get very constant results from checking the timer before and after this code runs -- even in an empty workbook with nothing else open. Any tips on speeding this up? Thanks! Stan With ActiveSheet.PageSetup 'margins are measured in points, 72 points to the inch .LeftMargin = 36 .RightMargin = 36 .TopMargin = 36 .BottomMargin = 36 .HeaderMargin = 0 .FooterMargin = 0 .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False End With |
#2
|
|||
|
|||
PageSetup macro calls are slow
Here's a thread that addresses the same problem:
http://groups.google.com/groups?thre...GP12.phx. gbl Two tips are included--only adjust the parms you need to adjust. Use the John Green version (XLM works faster than VBA in this situation). (posted by Tom Ogilvy and Ron de Bruin) Stan wrote: The code below takes nearly 11 seconds to run; this is on a WinXP with a P4 at 1.2 GHz, 512MB RAM, oceans of free disk space, and Excel 2002. Experiments with various lines commented out show that each line requires an astonishing 1.2 seconds to run, except the last three (.Zoom and the two .FitToPages lines), which execute all but instantaneously. Other open programs, available RAM, all the usual suspects for slow code don't seem to matter here; I get very constant results from checking the timer before and after this code runs -- even in an empty workbook with nothing else open. Any tips on speeding this up? Thanks! Stan With ActiveSheet.PageSetup 'margins are measured in points, 72 points to the inch .LeftMargin = 36 .RightMargin = 36 .TopMargin = 36 .BottomMargin = 36 .HeaderMargin = 0 .FooterMargin = 0 .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False End With -- Dave Peterson |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro when a font in a range changes | whisperinghill | General Discussion | 0 | June 14th, 2004 07:21 PM |
Macro command go to last filled cell in column? | PatsyB. | Setting up and Configuration | 1 | May 17th, 2004 08:09 PM |
word error | mac | General Discussions | 1 | May 6th, 2004 08:14 AM |
Laptop: PageSetup slow when connected to net | Art Du Rea | Worksheet Functions | 0 | April 6th, 2004 06:50 PM |
Macro | Nicole | Worksheet Functions | 4 | October 9th, 2003 09:53 PM |