Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default PageSetup slow

**** Post for FREE via your newsreader at post.usenet.com ****

I have done the following test code and found it very slow. Almost 7 seconds
to complete. I know someone also did a similar test and found the same
results. Is there any way to make the page setup run faster ? I have tried
to disable the display of page break as suggested by Microsoft knowledg base
but no help.

Thanks in advance.
Oliver


Sub Macro1()

MsgBox ("Start ...")

ActiveSheet.DisplayPageBreaks = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$20:$20"
.PrintTitleColumns = "$A:$B"
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "Test company"
.CenterHeader = ""
.RightHeader = "CFTR 30 SL"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlOverThenDown
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 2
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With

MsgBox ("Done")
End Sub



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default PageSetup slow

The best way is to eliminate the setting you are not changing. Each setting
you make is a different call to the pagesetup and takes a measurable amount
of time. Instead of setting 30 or so settings, you probably only need to
make 2 or 3 changes. Remove the rest.

Note that these settings are complimentary

.Zoom = False
.FitToPagesWide = 2
.FitToPagesTall = False



so if you are using fittopages you need zoom set to false.

You want to also set displaypagebreaks after you do the page setup as well -
although that will speed up code running later, not this code.

Regards,
Tom Ogilvy


"Oliver Chiu" wrote in message
...
**** Post for FREE via your newsreader at post.usenet.com ****

I have done the following test code and found it very slow. Almost 7

seconds
to complete. I know someone also did a similar test and found the same
results. Is there any way to make the page setup run faster ? I have tried
to disable the display of page break as suggested by Microsoft knowledg

base
but no help.

Thanks in advance.
Oliver


Sub Macro1()

MsgBox ("Start ...")

ActiveSheet.DisplayPageBreaks = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$20:$20"
.PrintTitleColumns = "$A:$B"
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "Test company"
.CenterHeader = ""
.RightHeader = "CFTR 30 SL"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlOverThenDown
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 2
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With

MsgBox ("Done")
End Sub



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot get VBA to Change PageSetup.FitToPagesWide = 1 EagleOne@microsoftdiscussiongroups[_2_] Excel Discussion (Misc queries) 6 April 26th 23 11:46 AM
PageSetup Macro Julian Glass Excel Worksheet Functions 1 March 29th 08 01:54 PM
PageSetup Stanley Excel Discussion (Misc queries) 1 December 14th 05 07:21 PM
Why is this PageSetup Macro So Slow? [email protected] Excel Discussion (Misc queries) 6 July 19th 05 09:28 PM
PageSetup.LeftFooter only on last Page Andy Excel Worksheet Functions 3 December 6th 04 01:53 PM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"