Consulting

Results 1 to 2 of 2

Thread: Solved: cancel ESC key

  1. #1
    VBAX Mentor
    Joined
    Dec 2009
    Posts
    416
    Location

    Solved: cancel ESC key

    Hello

    I have an macro that will make some calculation on entire workbook. But take some time till finish the calculation (around 3 sec). If I hit the ESC key in this time I have an window with code execution was been interrupted >> Continue ..etc.

    I like to tell to excel, wen the macro start, to do not stop wen the ESC key has been press (to give that message)

    I putted like this but it is not working:
    [VBA]
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
    Application.OnKey "{ESC}", "NoChange"
    If Sh.Name = "Calculation" Then Worksheet_Calculate
    End Sub
    [/VBA]

  2. #2
    VBAX Mentor
    Joined
    Dec 2009
    Posts
    416
    Location
    [VBA]
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
    Application.EnableCancelKey = xlDisabled
    If Sh.Name = "Calculation" Then Worksheet_Calculate
    Application.EnableCancelKey = xlInterrupt
    End Sub

    [/VBA]

Posting Permissions

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