Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/a/31124960/5079799

Notes:

  • KeyUp = When Key Is Released
  • KeyDown = When Key Is Pressed
  • I was able to use KeyUp for vbKeyEscape, but not for vbKeyReturn. While both worked w/ KeyDown. There for I'll only use KeyDown moving forward.





Private Sub TextBox2_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
 If KeyCode = vbKeyReturn Then
  Call OkButton_Click
 ElseIf KeyCode = vbKeyEscape Then
  Call CancelButton_Click
 End If
End Sub
  • No labels