Hi all,
Is there any VBA code to disable Esc key when opening the workbook.
Thank you,
Hi all,
Is there any VBA code to disable Esc key when opening the workbook.
Thank you,
Hi
This is not my code, but you can have a look at those 2 examples:
Sub auto_open()
Dim lCnt As Long
Application.EnableCancelKey = xlDisabled
For lCnt = 1 To 1000000000
Next lCnt
End Sub
Sub CaptureKeyBoardInterruptExample()
Dim X
'Set the error handler
On Error GoTo ReActToEvent
'set the EnableCancelKey property
Application.EnableCancelKey = xlErrorHandler
'run a loop that won't stop until either esc or ctrl-break is pressed.
While 1 = 1
X = X
Wend
Exit Sub
'control comes to this routine when either esc or ctrl-break is pressed
ReActToEvent:
MsgBox "Break Key Hit"
'turn back on the interrupt property
Application.EnableCancelKey = xlInterrupt
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks