Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
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
Pausing code execution until calculation is complete AVR Excel Programming 4 January 29th 07 05:29 PM
Efficiently Pausing VBA Execution. Devin Linnington Excel Programming 4 July 5th 05 02:04 PM
VBA: Pausing Code Execution Michael Loganov Excel Programming 2 September 14th 03 10:53 AM
Pausing a VBA macro Dean Taylor Excel Programming 1 August 1st 03 05:44 PM
Pausing code execution Rohit Thomas Excel Programming 1 July 9th 03 10:58 PM


All times are GMT +1. The time now is 11:13 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"