The Anchorage
Personal website of Gregory K. Maxey, Commander USN (Retired)
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
The purpose of this Microsoft Word Tips & Microsoft Word Help page is to provide a quick macro solution to create a composite listing of all keybindings and keyboard shortcuts and publish my Keybinding Organizer AddIn. The composite listing includes all custom keybindings (shortcuts) which you have defined and assigned to execute commands, macros, styles, fonts, building blocks, or common symbols, and the current shortcut combinations defined for Words built-in commands.
Note: Whether a bug or by design, custom keybindings
defined using the category wdKeyCategoryMacro will not appear in the All
Commands Listing.
A representative list is shown below:
I've been a mouse man for a very long time. Primarily I use the mouse because, if for no other reason, I can't remember the keyboard shortcuts for all the various Word commands!
I knew that in Word, at least versions 2003 - 2013, I could create a list of current keyboard settings using the Word command "ListCommands" and that I could print (hard copy) a list of custom key assignments.
This left me with a two separate incomplete lists:
Using the following macro, I can create a composite, complete listing of keyboard shortcuts that I can save as a Word document or print.
Option Explicit Sub ListCompositeShortcuts() Dim oDoc As Word.Document Dim oDocTemp As Word.Document Dim oKey As KeyBinding Dim oTbl_1 As Word.Table, oTbl_2 As Word.Table Dim oRng As Word.Range Dim lngIndex As Long Dim oRow As Word.Row 'Create a new document for listing composite shortcuts. Set oDoc = Documents.Add(, , wdNewBlankDocument) Set oRng = oDoc.Range System.Cursor = wdCursorWait Application.ScreenUpdating = False CustomizationContext = NormalTemplate 'or the template\document to evaluate. 'List and sort custom keybindings. For lngIndex = 1 To KeyBindings.Count Set oKey = KeyBindings(lngIndex) oRng.InsertAfter vbCr & oKey.KeyCategory & vbTab & oKey.Command _ & vbTab & oKey.KeyString 'Update status bar. Application.StatusBar = "Processing custom keybinding " & lngIndex & " of " & _ KeyBindings.Count & ". Please wait." DoEvents Next lngIndex 'Show progress to user. With Application .ScreenUpdating = True .ScreenRefresh .ScreenUpdating = False End With 'Convert text to table or create table. Leave empty paragraph beginning the document. oRng.MoveStart wdParagraph, 1 If Len(oRng.Text) > 2 Then Set oTbl_1 = oRng.ConvertToTable Else Set oTbl_1 = oRng.Tables.Add(oRng, 2, 3) End If 'Format table. With oTbl_1 .Style = "Table Grid" .Range.NoProofing = True With .Rows .Add BeforeRow:=oTbl_1.Rows(1) .Add BeforeRow:=oTbl_1.Rows(1) End With With .Rows(1) .HeadingFormat = True With .Range .Cells.Merge With .Cells(1).Range .ParagraphFormat.Alignment = wdAlignParagraphCenter .Text = "Current Keyboard Settings - Custom Key Bindings" .Font.Bold = True End With End With End With With .Rows(2) .HeadingFormat = True .Shading.BackgroundPatternColor = wdColorGray10 .Cells(1).Range.Text = "Category" .Cells(2).Range.Text = "Name/Symbol" .Cells(3).Range.Text = "Shortcut Key Combination" End With For lngIndex = 3 To .Rows.Count Select Case Left(.Rows(lngIndex).Cells(1).Range.Text, _ Len(.Rows(lngIndex).Cells(1).Range.Text) - 2) Case "1": .Rows(lngIndex).Cells(1).Range.Text = "Command" Case "2": .Rows(lngIndex).Cells(1).Range.Text = "Macro" Case "3": .Rows(lngIndex).Cells(1).Range.Text = "Font" Case "4": .Rows(lngIndex).Cells(1).Range.Text = "BuildingBlock\AutoText" Case "5": .Rows(lngIndex).Cells(1).Range.Text = "Style" Case "6": .Rows(lngIndex).Cells(1).Range.Text = "Symbol" End Select Next lngIndex 'Sort on category. .Sort True, 1 End With 'Add and format document title. With oDoc.Paragraphs(1).Range .InsertBefore "Composite Shortcut List" .Style = "Title" End With 'Show progress to user. With Application .ScreenUpdating = True .ScreenRefresh .ScreenUpdating = False End With 'Add paragraph separator. oRng.InsertAfter vbCr oRng.Collapse wdCollapseEnd 'Create the built-in list using the Word command. Application.ListCommands ListAllCommands:=0 'This creates a new active document. Set oDocTemp = ActiveDocument 'Clean up Word 2003 list. With Application If CLng(Left(.Version, 2)) < 12 Then .ScreenUpdating = True .ScreenRefresh .ScreenUpdating = False .StatusBar = "Processing temporary list. Please wait" With oDocTemp.Tables(1) .Columns(4).Delete For lngIndex = oDocTemp.Tables(1).Rows.Count To 1 Step -1 Set oRow = oDocTemp.Tables(1).Rows(lngIndex) If Len(oRow.Cells(2).Range) = 2 Then oRow.Delete End If DoEvents Next lngIndex End With End If End With 'Get the list (table) and kill the document. oDocTemp.Range.Copy oDocTemp.Close wdDoNotSaveChanges 'Ensure the composite list is the active document. oDoc.Activate 'Paste the copied table into the composite list. oRng.Paste Set oTbl_2 = oDoc.Tables(2) 'Format table. With oTbl_2 .Style = "Table Grid" With .Range .Font.Bold = False .NoProofing = True End With .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 100 .Rows.Add BeforeRow:=oTbl_2.Rows(1) With .Rows(1) .HeadingFormat = True With .Range .Cells.Merge With .Cells(1).Range .ParagraphFormat.Alignment = wdAlignParagraphCenter .Text = "Current Keyboard Settings - All Commands" .Font.Bold = True End With End With End With For lngIndex = 2 To .Rows.Count Application.StatusBar = "Processing built-in keybinding " & lngIndex - 1 _ & " of " & oTbl_2.Rows.Count - 1 & ". Please wait." With .Rows(lngIndex) .Cells(2).Merge .Cells(3) .Cells(2).Range.Text = Replace(.Cells(2).Range.Text, vbCr, "") End With DoEvents Next lngIndex With .Rows(2) .HeadingFormat = True .Shading.BackgroundPatternColor = wdColorGray10 .Cells(1).Range.Text = "Command Name" .Cells(2).Range.Text = "Shortcut Key Combination" End With .Range.Cells.DistributeWidth End With 'Prevent (or try to prevent) a blank page at end of document. Do While Len(oDoc.Paragraphs.Last.Previous.Range) = 1 oDoc.Paragraphs.Last.Previous.Range.Delete Loop Set oRng = oDoc.Paragraphs.Last.Range With oRng .Paragraphs(1).SpaceBefore = 0 .Paragraphs(1).SpaceAfter = 0 .Paragraphs(1).Range.Font.Size = 1 End With lbl_Exit: System.Cursor = wdCursorNormal Beep With Application .StatusBar = "Finished!!" .ScreenUpdating = True .ScreenRefresh End With Exit Sub End Sub
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.
Due to the large number of built-in Word shortcuts, it may take a while to process and complete the list. On my system with my shortcuts it takes about 20 seconds. The actual time will vary depending on your system speed and the number of shortcuts. Accordingly, so you won't lose hope and think Word has hung up, I've added a process indicator to the status bar.
Note: In Word 2003, the built-in list requires additional processing and will take a few seconds longer to complete.
Following participation in a Microsoft Answers discussion on keybindings, I decided to come back to this topic and try to develop a comprehensive Word template AddIn for working with keybindings. The following discussion addresses that AddIn and provides a download link.
When placed in the Word Startup folder or loaded manually using the Ribbon Developer tab, Template group the AddIn user interface appears on the Ribbon AddIns Tab:
Note: On first use and prior to acknowledging the add-in disclaimer, the "Create Shortcut List" control is disabled.
On first use, when the "Keybindings Organizer" is pressed, the add-in displays the user disclaimer.
After the accepting the disclaimer, the main UI is presented:
In the example below, the user has selected the Keybinding AddIn Demo Template containing custom keybindings. I loaded the template manually using the Ribbon Developer Tab, Templates Group.
When EXECUTE is pressed, the user must confirm the EXECUTE command.
The result of the defined EXECUTE action is a new Word document containing a properly defined Keybinding Definition Table.
This document can be saved and used later to restore lost or corrupted keybindings or be used to transfer keybindings to another template. To restore or transfer keybindings the user simply opens the saved file as the active document and then uses the AddIn as shown below:
A Legend and Help links are provided in the AddIn for users who may be interested in defining shortcuts using a Keybinding Definition Table:
Here is an example of a Keybinding Definition Table edited to create a keybinding to set the styles as Heading 2 using Alt+Ctrl+H,2:
Download AddIn: KEYBINDINGS AddIn
For more on template add-ins and how to load them, see: Organizing Your Macros/Template Add-ins at: Installing Macros
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.
Note: This tips page, illustrations and examples were developed using Word 2019. The AddIn should be compatible with all previous Ribbon versions of Word for PC.
That's it! I hope you have found this tips page useful and informative.
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!