[VBA ] KeyDown顯示未定義

作者: sinlin (豆漿)   2023-04-18 12:50:23
想在excel使用keydown功能結果一直沒反應
寫了一個簡單的測試程式對按F鍵反應
結果compile顯示使用者自訂型態尚未定義
請問這該如何解決
Private Sub Worksheet_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = vbKeyF Then 'check if the user has pressed the F key
MsgBox "You pressed the F key!" 'display a message box
End If
End Sub
作者: waiter337 (給開司一罐蘇格登)   2023-04-20 22:22:00
If KeyCode = 70 Then
作者: ShoterMan (修特)   2023-05-26 11:03:00
我自己測試 用 onkey 勉強可行

Links booklink

Contact Us: admin [ a t ] ucptt.com