L
Loomah
Hi
I'm trying to disable keyboard shortcuts such as CTRL+X. I've been looking
for something similar to the OnKey method available in Excel but all I have
been able to piece together is the code below. Everything I've seen in the
help files etc suggests I'm right here but the fact that it doesn't work
suggests I'm not that smart!!! I have been able to assign new combinations
to a test macro and then remove that combination while I've been
experimenting.
I have no real experience of Word VBA but a fair bit in XL.
The follow up problem would be where to place this code (if it worked) or
the correct version of it so that a change in document would not be affected
(same as Workbook Activate & Deactivate events)
Sub DisableCut()
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(wdKeyControl, wdKeyX)).Clear
End Sub
Sub EnableCut()
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyX), _
KeyCategory:=wdKeyCategoryCommand, Command:="editcut"
End Sub
Thanks in advance
Any help is greatly appreciated
;-)
I'm trying to disable keyboard shortcuts such as CTRL+X. I've been looking
for something similar to the OnKey method available in Excel but all I have
been able to piece together is the code below. Everything I've seen in the
help files etc suggests I'm right here but the fact that it doesn't work
suggests I'm not that smart!!! I have been able to assign new combinations
to a test macro and then remove that combination while I've been
experimenting.
I have no real experience of Word VBA but a fair bit in XL.
The follow up problem would be where to place this code (if it worked) or
the correct version of it so that a change in document would not be affected
(same as Workbook Activate & Deactivate events)
Sub DisableCut()
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(wdKeyControl, wdKeyX)).Clear
End Sub
Sub EnableCut()
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyX), _
KeyCategory:=wdKeyCategoryCommand, Command:="editcut"
End Sub
Thanks in advance
Any help is greatly appreciated
;-)