+ Reply to Thread
Results 1 to 3 of 3

Is there a reset shortcut

  1. #1

    Is there a reset shortcut

    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.


  2. #2
    Gary L Brown
    Guest

    RE: 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 **** Kusleika's website
    'Daily Dose of Excel' (http://www.*****-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
    gary_brown@ge_NOSPAM.com
    If this post was helpful, please click the ''Yes'' button next to ''Was this
    Post Helpfull to you?''.


    "[email protected]" 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.
    >
    >


  3. #3
    Jim Thomlinson
    Guest

    RE: Is there a reset shortcut

    You can use the escape key something like this for interupting a loop...

    Private Sub CommandButton1_Click()
    Dim lng As Long
    On Error GoTo ErrorHandler
    Application.EnableCancelKey = xlErrorHandler
    For lng = 1 To 1000000

    Next lng
    Exit Sub
    ErrorHandler:
    If Err = 18 Then
    If MsgBox("Do you want to stop?", vbYesNo, "Quit?") = vbYes Then
    Application.StatusBar = False
    Application.EnableEvents = True
    Application.Calculation = xlCalculationAutomatic
    End
    Else
    Resume
    End If
    End If
    End Sub

    --
    HTH...

    Jim Thomlinson


    "[email protected]" 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.
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1