2007-08-06

Take some of the mousing out of Microsoft Word

One of the things that I hate most about Microsoft Word (and there are many) is the fact that so many frequently used actions have no keyboard shortcuts. While its possible to assign keyboard shortcuts to actions its easy to quickly run out of Ctrl-key or Alt-key combinations that can be remembered.

To solve this problem I decided to write some macros to make Microsoft Word operate more like good old XyWrite, which had a key that took you to a command line where you could enter short commands for every function.

The first step is to set up a hotkey to open the macro dialog. To do this click Tools - Customize - Keyboard (on bottom line of dialog), which gets you to the Customize Keyboard dialog. Here, select Tools in the Categories box, and then select ToolsMacro in the Commands box, then go to the Press New Shortcut Key box and hit Ctrl-m (or whatever hotkey you want), and then finally click the Assign button at the bottom. Now, whenever you hit Ctrl-m it will open the Macros dialog box, where you can type in any macro name and then hit enter to run the macro.

Next, record some macros for your most frequently used menu items, and assign them two (or three) letter names. Here are some of my favorites:

Sub pu()
' Paste Unformatted
' Same as Edit - Paste Special - Unformatted Text
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Public Sub hy()
'highlight yellow
'Same as clicking on the highlight icon on the toolbar
Selection.Range.HighlightColorIndex = wdYellow
End Sub

Public Sub aa()
' Accept All tracked changes
ActiveDocument.AcceptAllRevisions
MsgBox "All tracked changes have been accepted."
End Sub

Sub uc()
'Upper Case; Same as Format - Change Case - Uppercase
Selection.Range.Case = wdUpperCase
End Sub

Once you have written the two letter macros for your commonly used menu items you can run them from the keyboard without ever touching the mouse by hitting Ctrl-m, then typing the two letter macro name, and then hitting Enter. It looks more cumbersome than it is; its really only a total of 4 keystrokes to run any command.

No comments: