Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Runs Too Fast


Hi all

I have a macro that sets two print ranges and prints them. If I step
through the macro it works fine. If I run the macro it sets the print
ranges but doesn't print. It seems to run too quickly. I have tried
slowing the macro down but to no avail. Can anyone help?

Thanks
Regards
Liz

Macro:

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub

Slowed down version (in theory):


Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True
Sleep 2500

ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub


--
LizS
------------------------------------------------------------------------
LizS's Profile: http://www.excelforum.com/member.php...o&userid=28991
View this thread: http://www.excelforum.com/showthread...hreadid=495743

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Macro Runs Too Fast

Maybe try some DoEvents.

RBS

"LizS" wrote in message
...

Hi all

I have a macro that sets two print ranges and prints them. If I step
through the macro it works fine. If I run the macro it sets the print
ranges but doesn't print. It seems to run too quickly. I have tried
slowing the macro down but to no avail. Can anyone help?

Thanks
Regards
Liz

Macro:

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub

Slowed down version (in theory):


Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True
Sleep 2500

ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub


--
LizS
------------------------------------------------------------------------
LizS's Profile:
http://www.excelforum.com/member.php...o&userid=28991
View this thread: http://www.excelforum.com/showthread...hreadid=495743


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Runs Too Fast


Thanks for the suggetsion RBS - I will experiment with that. In the
meantime I've shoved a msgBox in the middle - not ideal but at least it
prints.
Thanks
Regards
Liz


--
LizS
------------------------------------------------------------------------
LizS's Profile: http://www.excelforum.com/member.php...o&userid=28991
View this thread: http://www.excelforum.com/showthread...hreadid=495743

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro Runs Too Fast

if i just run those 4 lines of code, it prints for me. you must have
something else going on.

--


Gary


"LizS" wrote in message
...

Hi all

I have a macro that sets two print ranges and prints them. If I step
through the macro it works fine. If I run the macro it sets the print
ranges but doesn't print. It seems to run too quickly. I have tried
slowing the macro down but to no avail. Can anyone help?

Thanks
Regards
Liz

Macro:

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub

Slowed down version (in theory):


Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub PrintSearch()

ActiveSheet.PageSetup.PrintArea = "$a$1:$b$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True
Sleep 2500

ActiveSheet.PageSetup.PrintArea = "$c$1:$f$50"
Sleep 2500

ActiveSheet.PrintOut Copies:=1, Collate:=True

End Sub


--
LizS
------------------------------------------------------------------------
LizS's Profile:
http://www.excelforum.com/member.php...o&userid=28991
View this thread: http://www.excelforum.com/showthread...hreadid=495743



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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
Runs fast then slow rpw Excel Programming 17 February 28th 07 10:32 PM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
Macro runs in source , but not when in Personal Macro Workbook Darin Kramer Excel Programming 1 September 13th 05 04:48 PM
macro too fast??? mike Excel Programming 2 January 29th 04 03:06 PM


All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"