sparky2205
Well-known Member
- Joined
- Feb 6, 2013
- Messages
- 507
- Office Version
- 365
- 2016
- Platform
- Windows
I have a macro to delete worksheets.
The first step is to select the worksheet name.
The user is presented with a popup list of worksheet names
At this point I want to give the user the option to press Esc and quit the operation.
This is how I had hoped to achieve this (partial code):
The problem is
doesn't appear to work as after the Esc key is pressed the code continues to execute i.e. it does not jump to errhandler.
Hopefully I'm making some basic mistake that you can point out to me.
Note: Ctrl+Break does work.
The first step is to select the worksheet name.
The user is presented with a popup list of worksheet names
At this point I want to give the user the option to press Esc and quit the operation.
This is how I had hoped to achieve this (partial code):
VBA Code:
Sub Delete_Worksheet()
On Error GoTo errhandler
Application.EnableCancelKey = xlErrorHandler
Application.CommandBars("Workbook tabs").ShowPopup
[B].
.
.
.[/B]
errhandler:
End
End Sub
The problem is
VBA Code:
Application.EnableCancelKey = xlErrorHandler
Hopefully I'm making some basic mistake that you can point out to me.
Note: Ctrl+Break does work.