Microsoft KB Archive/65154

Undocumented Word for Windows Macro Commands

PSS ID Number: Q65154 Article last modified on 02-17-1993

1.00 1.10 1.10a WINDOWS

Summary: The following are some Microsoft Word for Windows macro commands that are not documented in the “Microsoft Word for Windows Technical Reference” manual. This information was gathered from a CompuServe forum.

More Information:

CountKeys(Context)
This returns the number of user-defined key assignments, both for keys assigned to user macros, and new key assignments to built-in macros. Context is 0 (global) or 1 (template).

CountMenuItems(Menu,Context)
This returns the number of menu items that have been ADDED to the specified Main menu in the specified context. Menu is equal to 1 through 8 (File, Edit, View, Insert, Format, Utilities, Macro, and Window); context is 0 (global) or 1 (template). For example, if you have added two menu items to the Edit menu, then num=CountMenuItems(2,0) would return 2.

KeyMacro$(Count,Context)
This returns the name of the macro associated with CountKeys(Count) (for example, the Count-th key assignment).

KeyCode(Count,Context)
This returns the name of the number associated with CountKeys(Count) (for example, the Count-th keycode). This number follows the convention outlined under MacroAssignToKey in the “Microsoft Word for Windows Technical Reference” manual.

MenuMacro$(Menu,Count,Context)
This returns the macro name that is associated with the added Count menu item on MenuItem in Context.

SentRight [Count],[Select]
This moves the insertion point right by Count sentences (1 is the default if no Count is supplied) and extends the selection if Select is nonzero.

SentLeft
This is the same as SentRight [Count],[Select], but it moves left. SentLeft and SentRight [Count],[Select] follow the same syntax as ParaUp/ParaDown, which means SentLeft can also be used as the following: Log = SentRight The SentRight and SentLeft commands have been included in the “Microsoft Word for Windows and OS/2 Technical Reference.” The entire list of macro commands above have been included in the Word for Windows version 2.0 macro documentation.

Reference(s): “Microsoft Word for Windows and OS/2 Technical Reference” pages 253-254.

Additional reference words: w4wmacro