Accelerator keys in vba forms

M

Marc Hankin

I have created forms with command buttons that use
Accelerator keys, but I'd like to not require the user to
hold down the Alt key. Does anyone know how I can
arrange things so that the user need only type the
letter "A" (if that's the accelerator key) and need not
type "Alt - A"?

Thanks,

Marc
 
H

Helmut Weber

Hi Marc,
have a look at the keypress-event, e.g
Private Sub CommandButton1_KeyPress(ByVal KeyAscii As _
MSForms.ReturnInteger)
If KeyAscii = 97 Then MsgBox "a"
End Sub
If the CommandButton1 has got the focus and "a" is pressed
the according action is performed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top