Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slow Response time
Hi Carl,
20 to 30 seconds is an awfully long time, so there may be something specific going wrong, but in general, page setup operations in VBA are very slow. The easiest way to speed up the code sample below is to not make so many settings. A brief look at it shows a number of lines that are simply applying the default settings (PrintHeadings, PrintGridlines, PrintComments) or are applying settings that can be set manually on the worksheet in advance and not have to be changed in VBA (Margins, Orientation, Zoom). In fact the following appear to be the only lines that don't fall into one of the two categories above. Make the manual settings required to reduce your code to the following and see if you get better times. With ActiveSheet.PageSetup .PrintArea = ActiveWorkbook.Names.Item("onhand") .PrintTitleColumns = ActiveWorkbook.Names.Item("onhandheading") End With -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "Carl Brehm" wrote in message ... The following code takes about 20 to 30 seconds to run in Excel 98. Why and how can I speed it up? With ActiveSheet.PageSetup .PrintArea = ActiveWorkbook.Names.Item("onhand") .PrintTitleColumns = ActiveWorkbook.Names.Item("onhandheading") .LeftMargin = Application.InchesToPoints(0.5) .RightMargin = Application.InchesToPoints(0.5) .TopMargin = Application.InchesToPoints(0.5) .BottomMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .PrintQuality = 600 .CenterHorizontally = True .CenterVertically = False .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperLetter .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 80 End With ActiveWindow.SelectedSheets.PrintOut -- Carl & Linda Brehm Lake Lafourche Bird House Hebert, LA Keets, Tiels, GN & Red Lories, Quakers Mitred Conures, TAG's,DYH, Bourkes, Cages, Toys, Toy parts Wholesale/Retail Feed & Supplies --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 07/24/2003 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
slow response to change in cell | Excel Discussion (Misc queries) | |||
Slow response opening Formats? | Excel Discussion (Misc queries) | |||
Slow ribbon response to ALT press | Excel Discussion (Misc queries) | |||
Excel SLOW !! Response time ... | Excel Discussion (Misc queries) | |||
Slow Response time | Excel Programming |