Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Why is this PageSetup Macro So Slow?
Below is a page setup macro that runs real fast on my Excel2000 WinXP Pro
Desktop but real slow on Excel2000 WinXP Home Laptop. I put msgboxes in to see what was slowing this macro up and the .TopMargin, ..BottomMargin, .Orientation and .PrintHeadings seemed to be taking a lot of time to finish. Any suggestions on how to speed this code up? Thanks. Dennis Sub Page_Setup() With ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .RightHeader = "&F &D &T &P/&N" .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.5) .Orientation = xlLandscape .Zoom = 75 .PrintHeadings = True .PrintGridlines = True End With End Sub |
#3
|
|||
|
|||
Thanks for the URL.
When I first copied the code into my Excel2000 VBA module it gave me the error "Too many line continuations". I combined 2 inputs per line and it then compiled ok. Now if I can only only my xyScatterChart problem in a post above. Thanks again. Dennis JE McGimpsey wrote: Take a look he http://www.mcgimpsey.com/excel/pagesetup.html In article , wrote: Below is a page setup macro that runs real fast on my Excel2000 WinXP Pro Desktop but real slow on Excel2000 WinXP Home Laptop. I put msgboxes in to see what was slowing this macro up and the .TopMargin, .BottomMargin, .Orientation and .PrintHeadings seemed to be taking a lot of time to finish. Any suggestions on how to speed this code up? Thanks. Dennis Sub Page_Setup() With ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .RightHeader = "&F &D &T &P/&N" .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.5) .Orientation = xlLandscape .Zoom = 75 .PrintHeadings = True .PrintGridlines = True End With End Sub |
#4
|
|||
|
|||
I tried it ran but but it didn't work. The Page Setup values did not change.
Here is my macro code: Option Explicit Sub Page_SetupXL4() '=====Adjust PageSetup using PageSetupXL4M sub===== PageSetupXL4M RightHead:="&F &D &T &P/&N", TopMarginInches:="0.75", _ BottomMarginInches:="0.5", PrintHeadings:="true", _ PrintGridlines:="true", _ Orientation:="xlLandscape", Zoom:="75" End Sub JE McGimpsey wrote: Take a look he http://www.mcgimpsey.com/excel/pagesetup.html In article , wrote: Below is a page setup macro that runs real fast on my Excel2000 WinXP Pro Desktop but real slow on Excel2000 WinXP Home Laptop. I put msgboxes in to see what was slowing this macro up and the .TopMargin, .BottomMargin, .Orientation and .PrintHeadings seemed to be taking a lot of time to finish. Any suggestions on how to speed this code up? Thanks. Dennis Sub Page_Setup() With ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .RightHeader = "&F &D &T &P/&N" .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.5) .Orientation = xlLandscape .Zoom = 75 .PrintHeadings = True .PrintGridlines = True End With End Sub |
#5
|
|||
|
|||
I found the reason the macro below didn't work.
In XL4 a landscape Orientation should be "2" not "xlLandscape". When I set Orientation:="2" everything worked. Dennis wrote: I tried it ran but but it didn't work. The Page Setup values did not change. Here is my macro code: Option Explicit Sub Page_SetupXL4() '=====Adjust PageSetup using PageSetupXL4M sub===== PageSetupXL4M RightHead:="&F &D &T &P/&N", TopMarginInches:="0.75", _ BottomMarginInches:="0.5", PrintHeadings:="true", _ PrintGridlines:="true", _ Orientation:="xlLandscape", Zoom:="75" End Sub JE McGimpsey wrote: Take a look he http://www.mcgimpsey.com/excel/pagesetup.html In article , wrote: Below is a page setup macro that runs real fast on my Excel2000 WinXP Pro Desktop but real slow on Excel2000 WinXP Home Laptop. I put msgboxes in to see what was slowing this macro up and the .TopMargin, .BottomMargin, .Orientation and .PrintHeadings seemed to be taking a lot of time to finish. Any suggestions on how to speed this code up? Thanks. Dennis Sub Page_Setup() With ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .RightHeader = "&F &D &T &P/&N" .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.5) .Orientation = xlLandscape .Zoom = 75 .PrintHeadings = True .PrintGridlines = True End With End Sub |
#6
|
|||
|
|||
Depends on your version of XL. In XL03/04, xlLandscape is a defined
constant with the value of 2. In article , wrote: I found the reason the macro below didn't work. In XL4 a landscape Orientation should be "2" not "xlLandscape". When I set Orientation:="2" everything worked. |
#7
|
|||
|
|||
I have Excel2000 and I don't know which version of XL it's using. All I know is
that when I changed xlLandscape to "2" the code worked. Thanks again for the URL JE McGimpsey wrote: Depends on your version of XL. In XL03/04, xlLandscape is a defined constant with the value of 2. In article , wrote: I found the reason the macro below didn't work. In XL4 a landscape Orientation should be "2" not "xlLandscape". When I set Orientation:="2" everything worked. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Help with macro looping and color query function | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
Date macro | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) |