none
Escape key in UserForm RRS feed

  • Question

  • Hi there, I have created a userform with two main options, and also the standard red cross in the top right-hand corner. I have set the cross to do the same as the default option, and I would like the escape key to do the same (i.e. all actions should produce the default response except specifically selecting the alternative option). However, the escape key is not giving any response. Does anyone know why it would not have any effect, and how it can be set up to produce a response (which i can then set to my desire option)?

    Thank you.

    Monday, August 18, 2014 3:04 PM

Answers

All replies

  • Re: Intercepting the Escape key on a UserForm

    In the VBE properties window for the UserForm, Set the "Cancel" property of your cancel/exit/quit button to True.
    '---
    Jim Cone
    Portland, Oregon USA
    free and commercial excel programs (n/a xl2013)
    https://goo.gl/IUQUN2 (Dropbox)

    • Edited by James Cone Tuesday, October 18, 2016 5:01 PM
    Monday, August 18, 2014 4:19 PM
  • Thanks for your reply Jim, but I do not see any "Cancel" property...
    Monday, August 18, 2014 4:50 PM
  • Re:  Button Cancel Property



    '---
    Jim Cone
    https://goo.gl/IUQUN2 (Dropbox)




    • Marked as answer by SKKPG Tuesday, August 19, 2014 8:24 AM
    • Edited by James Cone Tuesday, October 18, 2016 5:01 PM
    Monday, August 18, 2014 5:33 PM
  • Great, got it working. Did have to have a cancel button, which for some reason has no effect when it is made not visible (which is what I would have liked, and it seems a bit strange to have an option of it not being visible if you then cannot reach it with escape, but i guess there is another use for that).

    Thanks for your help.

    Tuesday, August 19, 2014 8:24 AM