Hi all,
I am trying to close a number of userforms where I have stripped them of any headers etc. with buttons to close them down which I have working but from a more accessible user friendly experience I would also like it if the user could just close the userform with the ESC key.
I have the below code in some of my userforms which works perfectly:
however this only seems to work on userforms where there are no inputs, so for example a userform where all that is display is labels etc. but where I have dropboxes, comboboxes, textboxes, radio buttons etc. essentially anywhere the focus is taken from the userform and the user can select any of these options, the code doesnt work. I presume because the focus is no longer on the Userform itself but the option within it.
I worked out that I can essentially copy the above code to keypress events for each individual textbox, radio button, dropbox etc. which does work, but it is a lot of repetition as there are about 30 items on the userform I would need to copy it for. Is there a better way I can do it so that it applies to the userform open, regardless if the user is in the textbox or dropbox etc.
thanks
Bookmarks