MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 24th, 2002, 02:20 AM   #1
JayKay
New Member
 
Join Date: May 2002
Location: Leicester, UK
Posts: 40
Default

Hi

Hope one of the MVP can help me out with this one. Is there any way to stop my VBA code slowing to a snails pace when altering Page Setup? I have a couple of toggle buttons on my sheets that change between centred printing for one-offs and offset printing with a page footer if the report is going into a bound document. The problem becomes even worse if the default printer is a colour printer! I've tried using the 'Application.ScreenUpdating = False', but ths doesn't help.

Thanks in advance.

JayKay
JayKay is offline   Reply With Quote
Old May 24th, 2002, 02:27 AM   #2
Colo
MrExcel MVP
 
Colo's Avatar
 
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
Default

Hi JayKay,

How about this?
Please check the following thread.

Colo Posted: 2002-05-14 23:08
http://www.mrexcel.com/board/viewtop...rum=2&start=10
__________________
Regards,

Masaru Kaji aka Colo - Ex Microsoft MVP Since 2004 -2009
Colo is offline   Reply With Quote
Old May 24th, 2002, 02:28 AM   #3
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-24 01:20, JayKay wrote:
Hi

Hope one of the MVP can help me out with this one. Is there any way to stop my VBA code slowing to a snails pace when altering Page Setup? I have a couple of toggle buttons on my sheets that change between centred printing for one-offs and offset printing with a page footer if the report is going into a bound document. The problem becomes even worse if the default printer is a colour printer! I've tried using the 'Application.ScreenUpdating = False', but ths doesn't help.

Thanks in advance.

JayKay
Hi JayKay
Colo provided a solution to this using sendkeys
Another variation to this was to use the old xl4 macro...I testd these and they are both
about the same interms of speed. But setting
it up is easier with Colos.
Both are FASTER by far then the Std method.
Also try setting the viewpagebreaks to off.


Sub Test1()
'Colo
St = Timer
Application.SendKeys "{ENTER}", False
Application.Dialogs(xlDialogPageSetup).Show _
Arg1:="&""Arial,Bold""&18SampleTable@", _
Arg3:=0.590551181102362, _
Arg4:=0.590551181102362, _
Arg5:=0.866141732283465, _
Arg6:=0.275590551181102, _
Arg9:=True, _
arg10:=True, _
Arg11:=2, _
Arg12:=8, _
Arg18:=0.590551181102362, _
Arg19:=0.511811023622047
[B2] = Timer - St
End Sub


Sub Test3()
'Mine

Dim sHead As String, sFoot As String, left, right, top, bot, hdng, grid, h_cntr, v_cntr
Dim orient, paper_size, iscale, pg_num, pg_order, bw_cells, quality
Dim head_margin, foot_margin, notes, draft

'// NB: If any of the Variables are set wrong you will
'// Get NO error BUT it won't setup as you want.
ExecuteExcel4Macro ("Page.Setup(""Hello"",""Testing"",0.75,0.75,1,1,FALSE,FALSE,FALSE,FALSE,2,9,TRUE,100,1,FALSE,360,0.5,0.5,FALSE,FALSE)")

End Sub


__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 24th, 2002, 02:30 AM   #4
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Hey Colo, you were too fast for me!

Actually when you test the speeds more
the xl4 is faster

__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 24th, 2002, 02:35 AM   #5
JayKay
New Member
 
Join Date: May 2002
Location: Leicester, UK
Posts: 40
Default

Hi Guys

Many thanks for the responses, I'll give them a try and test for speed.

I can't belive that I've been using Excel day in, day out for the last 8 years (VBA for the last 4) and yet I've only just dicovered this message board, I think it will be a god send!

Many thanks

JayKay
JayKay is offline   Reply With Quote
Old May 24th, 2002, 03:49 AM   #6
JayKay
New Member
 
Join Date: May 2002
Location: Leicester, UK
Posts: 40
Default

Hi Ivan / Colo

The Sendkeys method has worked a treat and my code is now running much faster.

I've managed to work out what most of the argument numbers refer to in the code via a little trial and error, but was wondering if there are any resources, either on the net, or within Excel that would list the argument numbers and what item they refer to on this and other Standard Dialog boxes. The tooltips in VBA just list the argument numbers in order and they don't seem to bare any relation to the order the fields appear on the PageSetup dialog.

Cheers again

JayKay
JayKay is offline   Reply With Quote
Old May 24th, 2002, 06:00 AM   #7
JayKay
New Member
 
Join Date: May 2002
Location: Leicester, UK
Posts: 40
Default

Bump
JayKay is offline   Reply With Quote
Old May 24th, 2002, 08:05 AM   #8
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-24 02:49, JayKay wrote:
Hi Ivan / Colo

The Sendkeys method has worked a treat and my code is now running much faster.

I've managed to work out what most of the argument numbers refer to in the code via a little trial and error, but was wondering if there are any resources, either on the net, or within Excel that would list the argument numbers and what item they refer to on this and other Standard Dialog boxes. The tooltips in VBA just list the argument numbers in order and they don't seem to bare any relation to the order the fields appear on the PageSetup dialog.
Cheers again

JayKay
HI JK
from the help files on xlDialogPageSetup
I think they are in numerical order and
are the same that I listed for the ExecuteExcel4Macro.

head, foot, left, right, top, bot, hdng, grid, h_cntr, v_cntr, orient, paper_size, scale, pg_num, pg_order, bw_cells, quality, head_margin, foot_margin, notes, draft

I was going to tidy it up a bit....
__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes