It's always useful to use the macro recording tool when searching for information in Office. First write a simple subroutine "test". Then select Record new macro from the Tools menu, and assign a key combination to your macro (I chose CTRL+NUM 4 in this example). I have the norwegian version of Word, but you should find this key assign dialog box by rightclicking the toolbar -> customize -> commands -> keyboard (translated from my norwegian menues).
Stop recording the macro, and look at the code generated:
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyNumeric4, wdKeyControl), _
KeyCategory:=wdKeyCategoryMacro, Command:=""
Now, by exploring the KeyBindings collection, you'll find a couple of interesting properties (remember to execute the CustomizationContext = ActiveDocument command first) :
KeyBindings.Count - number of custom keyboard shortcuts in this document
KeyBindings.Item(n) - returns a KeyBinding object (see the help file for more information on this object)
KeyBindings.Item(n).Command - the macro that is assigned to this key
KeyBindings.Item(n).KeyString - Returned "Ctrl+Num 4" in this case.
Dag Christensen
> Date: Fri, 3 Dec 1999 01:25:20 -0500
> From: Paul Ecclestone <[log in to unmask]>
> Subject: Word 97 macros
>
> 2 questions.
> 1. Does anyone know of a way to tell what the keyboard shortcut is on an
> existing Word 97 macro?
> 2. How would one go about changing that shortcut to a different keystroke
> combination?
>
> Paul Ecclestone
>
PCSOFT only works if you contribute. Send your messages
to be posted to: [log in to unmask]
|