Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pausing a macro during execution
I have a macro that moves some objects around on a spreadsheet to
simulate a process. It has a start and stop time it is set to run. What I would like to do is be able to hit the ESC or some other hey while the macro(s) are processing, it would stop where it is at and then if I hit the button again it would continue. I dont want the VB message box that says "code execution has been interrupted" to pop up and take me to the VB editor. I just want a simple pause. I am thinking there has to be some way to look for key stokes and then if a certian one is encountered be able to pause until it is hit again. Thanks Scott RIddle |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pausing a macro during execution
This is not exactly what you are looking for but it is close. Hitting the Esc
key will pause execution... Public Sub PauseMacroIsh() Dim lng As Long Application.EnableCancelKey = xlErrorHandler On Error GoTo ErrorCleanUp For lng = 1 To 100000 Application.StatusBar = lng Next lng ErrorCleanUp: If Err = 18 Then MsgBox "macro has been paused" Resume Else Application.StatusBar = False End If End Sub -- HTH... Jim Thomlinson "Scott" wrote: I have a macro that moves some objects around on a spreadsheet to simulate a process. It has a start and stop time it is set to run. What I would like to do is be able to hit the ESC or some other hey while the macro(s) are processing, it would stop where it is at and then if I hit the button again it would continue. I dont want the VB message box that says "code execution has been interrupted" to pop up and take me to the VB editor. I just want a simple pause. I am thinking there has to be some way to look for key stokes and then if a certian one is encountered be able to pause until it is hit again. Thanks Scott RIddle |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pausing code execution until calculation is complete | Excel Programming | |||
Efficiently Pausing VBA Execution. | Excel Programming | |||
VBA: Pausing Code Execution | Excel Programming | |||
Pausing a VBA macro | Excel Programming | |||
Pausing code execution | Excel Programming |