Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hotkeys for a button

Status
Not open for further replies.

BenniP

Technical User
Nov 18, 2001
39
DE
Hi,

this might be a very stupid question, but how can I add a hotkey to a button?

thx again

bennip
 
in the caption for the command button put an & sign in front of the letter you want to be the hotkey, then you can use "alt-letter" to activate the button
David Moore
dm7941@sbc.com
 
[tt]
Private Sub Command1_Click()
MsgBox "button clicked"
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("z") Then
Command1_Click
End If
End Sub

Private Sub Form_Load()
KeyPreview = True
End Sub
[/tt]
 
thank you! thats what i was looking for.
 
Hi

Can someone explain to me how the code from Justin works? What variables are what? For instance, I need the Edit Button in my toolbar to be accessed by Alt E in addition to the actual mouse click.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top