ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pausing macros (https://www.excelbanter.com/excel-programming/365636-re-pausing-macros.html)

phil2006[_18_]

Pausing macros
 

When macros are running is there any way in which you can pause them,
save and resume?

Thanks.


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419


Duncan[_5_]

Pausing macros
 
I know that the command "Stop" will stop the macro, but then your save
command wont action until you press play again and that presumedly is
not what you want

I think if you ask for a save (activeworkbook.save) then it should save
before continuing. (I think, could be wrong though)

Duncan


phil2006 wrote:

When macros are running is there any way in which you can pause them,
save and resume?

Thanks.


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419



CWillis

Pausing macros
 
If you knew ahead of time where you wanted to pause, you could put a break in
the code (F9). I sometimes use a counter. When the counter reaches preset
values, the code pauses. Play or F5 continues the macro from the break point.
-Chris

"phil2006" wrote:


When macros are running is there any way in which you can pause them,
save and resume?

Thanks.


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419



phil2006[_19_]

Pausing macros
 

How do you get to the stop button? My problem is that I'm running macros
that iI've estimated will take 10-15 hours at their current rate. I
could do with getting some sort of pause or speeding them up so that I
can leave the computer.

Thanks


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419


CWillis

Pausing macros
 
The "run" (play), "break" (pause) and "reset" (Stop) buttons are on the
"standard" toolbar in the VBA window. If you do not see them, right click on
the top toolbar, and go to "customize". Under the "commands" tab, scroll
through the "Categories" until you see "Run". Under "commands" the first
three buttons should be "Run", "Break", and "Reset". Drag and drop each to
your toolbar.

As for speeding up the code, that would depend on the code...

"phil2006" wrote:


How do you get to the stop button? My problem is that I'm running macros
that iI've estimated will take 10-15 hours at their current rate. I
could do with getting some sort of pause or speeding them up so that I
can leave the computer.

Thanks


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419



Duncan[_5_]

Pausing macros
 
" How do you get to the stop button?"

just putting "Stop" in your code

i.e,
sub Test ()
Msgbox "Hello"
Stop
Msgbox "Goodbye"
End Sub

im not sure how safe it is to use this command, I know not (NOT) to put
it in the before print sub because it brings up a well old error
message and crashes the pc, also this would require your intervention
to continue running the code (press play manually) and you did state
you wanted to leave the pc

there is the command Application.Wait(specify time) and you could put a
line like

Application.Wait( now() + timeserial(0,0,10) )

which if im right (havent tested this) should wait 10 seconds before
commencing.

For speeding up issues, im only a beginner so I will leave this to the
more experianced to answer.

Hope this helps

Duncan


CWillis wrote:

The "run" (play), "break" (pause) and "reset" (Stop) buttons are on the
"standard" toolbar in the VBA window. If you do not see them, right click on
the top toolbar, and go to "customize". Under the "commands" tab, scroll
through the "Categories" until you see "Run". Under "commands" the first
three buttons should be "Run", "Break", and "Reset". Drag and drop each to
your toolbar.

As for speeding up the code, that would depend on the code...

"phil2006" wrote:


How do you get to the stop button? My problem is that I'm running macros
that iI've estimated will take 10-15 hours at their current rate. I
could do with getting some sort of pause or speeding them up so that I
can leave the computer.

Thanks


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=556419





All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com