View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary L Brown Gary L Brown is offline
external usenet poster
 
Posts: 219
Default Is there a reset shortcut

Putting this code in your procedure will allow you to test for the cancel
key. This is an example that I basically got from Dick Kusleika's website
'Daily Dose of Excel' (http://www.dicks-blog.com/)...
Modify as needed.

'/===========================================/
Private Sub ExampleOfHow2HandleTheUserPressingCANCEL()
Dim iTest As Double, iCount As Double
On Error GoTo err_Sub

'xlDisabled = 0 'totally disables Esc / Ctrl-Break / Command-Period
'xlInterrupt = 1 'go to debug
'xlErrorHandler = 2 'go to error handler
'Trappable error is #18
Application.EnableCancelKey = xlErrorHandler


'<<<<<<<<<<<<<<PUT YOUR CODE HERE

exit_Sub:
On Error Resume Next
Exit Sub

err_Sub:
If Err.Number = 18 Then
If MsgBox("You have stopped the process." & vbCr & vbCr & _
"QUIT now?", vbCritical + vbYesNo + vbDefaultButton1, _
"User Interrupt Occured...") = vbNo Then
Resume 'continue on from where error occured
End If
End If

GoTo exit_Sub

End Sub
'/===========================================/


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


" wrote:

Is there a shortcut for resetting a running application.

Grabbing the mouse then going to Run-Reset seems like a cludge. Like
there's a better way.