Andrew_LEJOG
New Member
- Joined
- Jun 18, 2008
- Messages
- 2
I have a potentially time consuming loop in a macro, within which I would like to give the user the option of pressing the ESCAPE <ESCAPE><ESCAPE>button which would then run another section of code (see the code below).
I would have thought that the Application.OnKey method would achieve this but nothing seems to happen when I press <ESCAPE>.
If anyone can suggest a solution, I would be very grateful.
Sub t()
MsgBox "Escape pressed"
End Sub
Sub Macro1()
For x = 1 To 100000
Application.OnKey "{ESC}", "t"
Next x
End Sub
Many thanks.
Andrew.
I would have thought that the Application.OnKey method would achieve this but nothing seems to happen when I press <ESCAPE>.
If anyone can suggest a solution, I would be very grateful.
Sub t()
MsgBox "Escape pressed"
End Sub
Sub Macro1()
For x = 1 To 100000
Application.OnKey "{ESC}", "t"
Next x
End Sub
Many thanks.
Andrew.
Last edited: