View Single Post
 
Old 11-24-2015, 03:40 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

In Windows, you might use userform code like:
Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim strMask As String, StrKey As String
Select Case Shift
  Case 1: strMask = "Shift+"
  Case 2: strMask = "Ctrl+"
  Case 3: strMask = "Ctrl+Shift+"
  Case 4: strMask = "Alt+"
  Case 5: strMask = "Alt+Shift+"
  Case 6: strMask = "Ctrl+Alt+"
  Case 7: strMask = "Ctrl+Alt+Shift+"
  Case Else: strMask = ""
End Select
Select Case KeyCode
  Case vbKeyF1: StrKey = "F1"
  Case vbKeyF2: StrKey = "F2"
  Case vbKeyF3: StrKey = "F3"
  Case vbKeyF4: StrKey = "F4"
  Case vbKeyF5: StrKey = "F5"
  Case vbKeyF6: StrKey = "F6"
  Case vbKeyF7: StrKey = "F7"
  Case vbKeyF8: StrKey = "F8"
  Case vbKeyF9: StrKey = "F9"
  Case vbKeyF10: StrKey = "F10"
  Case vbKeyF11: StrKey = "F11"
  Case vbKeyF12: StrKey = "F12"
  Case vbKeyHome: StrKey = "Home"
  Case vbKeyEnd: StrKey = "End"
  Case vbKeyPageUp: StrKey = "PageUp"
  Case vbKeyPageDown: StrKey = "PageDown"
End Select
TextBox1.Text = strMask & StrKey
End Sub
The KeyCode Select Case statement above contains only a partial KeyCode listing - see the VBA help file for the full KeyCode listing.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote