Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interrupt Excel code execution

Status
Not open for further replies.

automaker

Technical User
Aug 21, 2007
64
0
0
US
I have an application that can take a long time to run. Should the user want/need to stop during execution (press esc key), I would like to provide the option of saving certain parameters to a text file so the program can pick up where it left off and not have to start from the beginning. How do I go about attaching code to the esc key?
I am running Windows XP pro and VBA 6

If I can't use the esc key, is there another way for the user to interrupt the code execution?

Thanks for the help

 
Welcome to Tek-Tips. To get the best from these forums start by reading faq222-2244. Amongst other things it will guide you to post in the correct forum, in this case forum707

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Give this a shot,

Code:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = 27 Then: MsgBox "option of saving certain parameters to a text file "
End Sub

Private Sub Form_Load()
    Me.KeyPreview = True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top