Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default 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
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
slow response to change in cell George Excel Discussion (Misc queries) 2 November 3rd 08 07:41 PM
Slow response opening Formats? blueshoes9001 Excel Discussion (Misc queries) 6 October 30th 07 01:24 PM
Slow ribbon response to ALT press Mike Hayes Excel Discussion (Misc queries) 1 May 15th 07 10:26 AM
Excel SLOW !! Response time ... kbk_kbk_kbk Excel Discussion (Misc queries) 1 April 16th 06 08:37 PM
Slow Response time Carl Brehm Excel Programming 3 August 10th 03 07:10 AM


All times are GMT +1. The time now is 02:59 AM.

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"