View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Howard Kaikow Howard Kaikow is offline
external usenet poster
 
Posts: 269
Default PageSetup is very slow

"Howard Kaikow" wrote in message
...
In Excel 2003, on an old computer, the PageSetUp stuff (code below) takes
6-7 seconds in a visible Excel VBA IDE.
Using VB6 to automate Excel, corresponding code takes 9 seconds.

Commenting out the .Order = xlDownThenOver saves about 1 second.
Commenting out the .FirstPageNumber = xlAutomatic seems to have no impact,
likely because it is the default.

Does not seem to be any way to speed things up.

Sub TestPageSetup()
Dim d As Double
Dim d1 As Double

Application.ScreenUpdating = False

With ActiveSheet
Debug.Print Application.ScreenUpdating
Debug.Print Now
''''''''''''''''''''''''''''''''''''''''
With .PageSetup
.Orientation = xlLandscape
With .Application
d = .InchesToPoints(0.5)
d1 = .InchesToPoints(0.75)
End With
.LeftMargin = d
.RightMargin = d
.TopMargin = d1
.BottomMargin = d1
.HeaderMargin = d
.FooterMargin = d
.LeftHeader = "&F"
.CenterHeader = "&A"
.RightHeader = ""
.LeftFooter = "&D(&T)"
.CenterFooter = ""
.RightFooter = "Page &P of &N"
.PrintGridlines = True
' .FirstPageNumber = xlAutomatic
' .Order = xlDownThenOver
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
''''''''''''''''''''''''''''''''''''''''
Debug.Print Now
End With
Debug.Print Application.ScreenUpdating
Application.ScreenUpdating = True
End Sub



I'm baaaack!

previously, my main system was a Windoze 2000 Pentium II 400 with 768MB of
memory and three 7200 rpm SCSI hard drives.

As you may recall, from this, and other threads, I pointed out that
PageSetup was very slow , and the best that I could do was to split the
burden out of the Load event and display a splash screen at an appropriate
time. Typically, the PageSetup stuff took 8-9 seconds to run on the PII.

I put in a more accurate timer and the last time I ran on the PII, the time
was 8516 milliseconds.
At end of May, I purchased a Vista notebook with 4GB of memory, a 5400rpm
drive, and a 21.GHz Intel Centrino processor using Intel Core 2 Duo
Processor T8100.

I needed that to use Office 2007, and I figured that it would beat the crap
out of the PII speedwise.

Well, I finally got around to installing Office Ultimate 2007 today.

The Pagesetup stuff used 6085 milliseconds on a computer that is several
times faster than a PII 400. Rather disappointing!

I am using a .exe that was compiled with VB 6 and Excel 2003.
Maybe would be faster if I compiled with Excel 2007 and VB 6?
If so, then I may need to have a separate .exe for use with Excel 2007, not
a desired goal,