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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=