ButtonActivate




'Il form deve avere KeyPreview a True

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim bAlt
Dim btnX As Button
Dim sShortCut As String
bAlt = (Shift And vbAltMask) > 0
If bAlt And KeyCode >= 65 Then
sShortCut = "&" & Chr(KeyCode)
For Each btnX In tlbComandi.Buttons
If InStr(UCase(btnX.Caption), sShortCut) > 0 Then
If btnX.Enabled Then
btnX.Value = tbrPressed
tlbComandi_ButtonClick tlbComandi.Buttons(btnX.Index)
btnX.Value = tbrUnpressed
KeyCode = 0
End If
Exit For
End If
Next
End If
End Sub











( buttonactivate.html )- by Paolo Puglisi - Modifica del 17/12/2023