MS Excel for Mac 2011 - VB Ver 14.0 - Escape Key capture

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
622
Office Version
  1. 2011
Platform
  1. MacOS
Hi all,

Does anyone know if VB key capture works with Excel for Mac 2011?

I have tried several different methods to capture the ESC key being pressed and I can't seem to get it to do anything.

The last simple thing I tried was:
Application.OnKey "{ESC}", "EscapeKeyPressed"

inside the UserForm_Initialize sub,

and then just did a short:
Sub EscapeKeyPressed()
Msgbox "Escape key pressed"
End Sub


to see if that would work (unless I'm doing that wrong) and nothing happens.

Thanks.
 
Mike,

I did a quick search for the QueryClose event and it looks like this will do the job perfectly. It even covers the problem I had with someone clicking on the X to close the form, which I asked about in another thread. I couldn't do it via the Functions using Lib "user32" since I'm using a Mac.

Thanks Mike!
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top