Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've written a MS-Project VBA macro to export data to MS-Excel. The macro
works fine. The performance is good...until I get to the PageSetup section, then the performance drops. The entire macro takes 26 seconds to run, but 16 seconds of that are used up on the PageSetup command, which seems strange. I've included the PageSetup section below. As you can see I've commented out the portions that are not needed. Any ideas? ---------------------------------- Set ExcelApp = CreateObject("Excel.application") ' Open Excel. Default is ExcelApp.visible=false .... ExcelApp.ScreenUpdating = False ExcelApp.EnableEvents = False .... .DisplayPageBreaks = False ' I've read that this line should help but it didn't With .PageSetup .PrintArea = AllDataRange.Address .PrintTitleRows = "$2:$2" ' .PrintTitleColumns = "" ' .LeftHeader = "" ' .CenterHeader = "" ' .RightHeader = "" .LeftFooter = "&8&Z&F" .CenterFooter = "Page &P of &N" .RightFooter = "Printed: &D &T" .LeftMargin = ExcelApp.InchesToPoints(0.25) .RightMargin = ExcelApp.InchesToPoints(0.25) .TopMargin = ExcelApp.InchesToPoints(0.5) .BottomMargin = ExcelApp.InchesToPoints(0.5) .HeaderMargin = ExcelApp.InchesToPoints(0.25) .FooterMargin = ExcelApp.InchesToPoints(0.25) ' .PrintHeadings = False ' .PrintGridlines = False ' .PrintComments = xlPrintNoComments ' .PrintQuality = 600 ' .CenterHorizontally = False ' .CenterVertically = False .Orientation = xlLandscape ' .Draft = False .PaperSize = xlPaperLetter ' .FirstPageNumber = xlAutomatic ' .Order = xlDownThenOver ' .BlackAndWhite = False ' .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False ' .PrintErrors = xlPrintErrorsDisplayed End With ' .PageSetup |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
performance question | Excel Programming | |||
Performance question | Excel Programming | |||
performance question | Excel Programming | |||
PageSetup | Excel Programming | |||
VBA 'PageSetup' performance | Excel Programming |