Technologywatch
Nieuwe gebruiker
- Lid geworden
- 9 okt 2019
- Berichten
- 4
Weet iemand hoe je op een eenvoudige wijze alle shortcuts op een access formulier kan blokkeren?
Voor excel heb ik volgende oplossing op internet gevonden. Graag zou ik een gelijkaardige oplossing voor access hebben.
Voor excel heb ik volgende oplossing op internet gevonden. Graag zou ik een gelijkaardige oplossing voor access hebben.
Code:
Sub Disable_Keys()
Dim StartKeyCombination As Variant
Dim KeysArray As Variant
Dim Key As Variant
Dim I As Long
On Error Resume Next
'Shift key = "+" (plus sign)
'Ctrl key = "^" (caret)
'Alt key = "%" (percent sign
'We fill the array with this keys and the key combinations
'Shift-Ctrl, Shift- Alt, Ctrl-Alt, Shift-Ctrl-Alt
For Each StartKeyCombination In Array("+", "^", "%", "+^", "+%", "^%", "+^%")
KeysArray = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _
"{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _
"{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _
"{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}")
'Disable the StartKeyCombination key(s) with every key in the KeysArray
For Each Key In KeysArray
Application.OnKey StartKeyCombination & Key, ""
Next Key
'Disable the StartKeyCombination key(s) with every other key
For I = 0 To 255
Application.OnKey StartKeyCombination & Chr$(I), ""
Next I
'Disable the F1 - F15 keys in combination with the Shift, Ctrl or Alt key
For I = 1 To 15
Application.OnKey StartKeyCombination & "{F" & I & "}", ""
Next I
Next StartKeyCombination
'Disable the F1 - F15 keys
For I = 1 To 15
Application.OnKey "{F" & I & "}", ""
Next I
'Disable the PGDN and PGUP keys
Application.OnKey "{PGDN}", ""
Application.OnKey "{PGUP}", ""
End Sub
Sub Enable_Keys()
Dim StartKeyCombination As Variant
Dim KeysArray As Variant
Dim Key As Variant
Dim I As Long
On Error Resume Next
'Shift key = "+" (plus sign)
'Ctrl key = "^" (caret)
'Alt key = "%" (percent sign
'We fill the array with this keys and the key combinations
'Shift-Ctrl, Shift- Alt, Ctrl-Alt, Shift-Ctrl-Alt
For Each StartKeyCombination In Array("+", "^", "%", "+^", "+%", "^%", "+^%")
KeysArray = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _
"{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _
"{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _
"{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}")
'Enable the StartKeyCombination key(s) with every key in the KeysArray
For Each Key In KeysArray
Application.OnKey StartKeyCombination & Key
Next Key
'Enable the StartKeyCombination key(s) with every other key
For I = 0 To 255
Application.OnKey StartKeyCombination & Chr$(I)
Next I
'Enable the F1 - F15 keys in combination with the Shift, Ctrl or Alt key
For I = 1 To 15
Application.OnKey StartKeyCombination & "{F" & I & "}"
Next I
Next StartKeyCombination
'Enable the F1 - F15 keys
For I = 1 To 15
Application.OnKey "{F" & I & "}"
Next I
'Enable the PGDN and PGUP keys
Application.OnKey "{PGDN}"
Application.OnKey "{PGUP}"
End Sub
Laatst bewerkt: