在預設情況下,PAGE UP 與 PAGE DOWN 鍵可以用於來回瀏覽表單中的記錄。 下列範例說明如何使用表單的 KeyDown 事件來停用表單中 PAGE UP 和 PAGE DOWN 鍵的使用。
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
' The Keycode value represents the key that
' triggered the event.
Select Case KeyCode
' Check for the PAGE UP and PAGE DOWN keys.
Case 33, 34
' Cancel the keystroke.
KeyCode = 0
End Select
End Sub
注意事項
您必須將表單的 KeyPreview 屬性設定為 True ,此程式才能運作。
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。