KeyBinding with AutoOpen

J

John Wirt

These Keybinding statements are to be executed whenever a document is
opened:


Public Sub AutoOpen()
CustomizationContext = ActiveDocument
KeyBindings.Add _
KeyCategory:=wdKeyCategoryMacro, _
Command:="Quote", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyShift, wdKeyQ)
KeyBindings.Add _
KeyCategory:=wdKeyCategoryMacro, _
Command:="Comment", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyShift, wdKeyC)
KeyBindings.Add _
KeyCategory:=wdKeyCategoryMacro, _
Command:="TrackChanges", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyShift, wdKeyT)
End Sub

I installed this procedure in the "This Document" module of the document.

Unfortunately, the keys are not assigned when the document is opened. What's
wrong?

John Wirt

- - - - - - - - - - - - - - - - - -
The called procedures are:

Sub Quote()
Selection.Style = ActiveDocument.Styles("Quote")
End Sub
Sub Comment()
Selection.TypeText Text:=vbTab & "JW: "
End Sub

Sub TrackChanges()
If ActiveDocument.TrackRevisions = False Then
With ActiveDocument
.TrackRevisions = True
.ShowRevisions = True
End With
Else
With ActiveDocument
.TrackRevisions = False
.ShowRevisions = True
End With
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top