#1
|
||||
|
||||
Help moving keyboard shortcuts from 2007 to 2016 (365)
I have two basic questions:
The one I am struggling with at the moment is Alt+o (lowercase letter "o", for outline, not zero). It toggles the "view" between normal and outline view at the level of the line where the cursor is. If the cursor is on a level 3 heading, it will toggle between normal view and collapsing all headings of level 3 or greater. I have had this shortcut for so long that I completely forgot what it is assigned to. When I went to File | Options | Customize | Customize and typed Atl+o into the "Press new keyboard shortcut" box. It showed nothing, which cannot be right since I use this all the time. After scratching my head, I remembered that I had written a macro do to this. I've included the code below. So,
Code:
Sub MyOutlineLevel() 'Call MsgBox("ActiveWindow.View = " & ActiveWindow.View & vbCrLf _ ' & "Selection.Paragraphs(1).OutlineLevel = " _ ' & Selection.Paragraphs(1).OutlineLevel) Dim DocLayout 'The document layout (view) Dim ParOutline 'The paragraph outline level (1-9 + 10 (=Bodytext)) 'DocLayout = ActiveWindow.View.Type DocLayout = ActiveWindow.View ParOutline = Selection.Paragraphs(1).OutlineLevel Select Case DocLayout 'Check the layout (view) Case wdNormalView, wdPrintView 'If Normal or Page (print) view, If ParOutline = 10 Then 'If BodyText paragraph, Exit Sub 'Do nothing Else 'Else, must be a heading ActiveWindow.View.ShowHeading ParOutline 'Show headings only up to that level End If ActiveWindow.View.Type = wdOutlineView 'And switch to Outline view Case wdOutlineView 'If Outline view, ActiveWindow.View.ShowAllHeadings 'Show everything ActiveWindow.View.Type = wdNormalView 'And switch back to Normal view Case Else 'For any other view, Exit Sub 'NOP End Select End Sub |
#2
|
||||
|
||||
Keyboard shortcuts are saved to templates. If you aren't paying attention when you create one there is a good chance the change will be saved to the Normal.dotm template. When you go in to look for the macro name activated by a keyboard shortcut then you will need to know what template you are querying at the time.
A good way to find out what keyboard shortcuts are in a template is to print them out by going to Print and change the first option under the Settings to 'Key Assignments'.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
||||
|
||||
Quote:
Or are you referring to printing them as described below? Quote:
I tried File | Open | Trusted Templates. There are 4 listed. The last saved dates are in parens.
I opened Normal.dotm and printed the assignments. I got 7 pages. My macro (MyOutlineLevel) is not listed and Alt+O shows no assignments ion all three sections. The other files also have assignments, but just 2-3 pages and no mention of the macro. This is puzzling, because the macro is absolutely getting executed when I type Atl+o. I just tested it by setting a breakpoint. What about my second question: What's the recommended way to port my macros over to Word 2016 on Win 10. Can I, as I said, just create a code module under Normal and copy the macros there? Thanks |
#4
|
||||
|
||||
PS: Did they take away the option to print key assignments in Word 2016? I don't see it under the Print option like it is in Word 2007.
|
#5
|
||||
|
||||
The Keyboard assignments is still there on my recent version of Word.
And getting a report of the existing assignments in a particular template might be along the following lines when you put this code in the actual template you want to interrogate. Code:
Sub GetKeyboardAssignments() Dim aKB As KeyBinding, aKBs As KeyBindings CustomizationContext = ThisDocument ' or NormalTemplate Set aKBs = Application.KeyBindings For Each aKB In aKBs Debug.Print aKB.Context, aKB.KeyString, aKB.Command, aKB.CommandParameter Next aKB 'this line shows how to add a new keyboard assignment aKBs.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyControl, wdKeyD), KeyCategory:=wdKeyCategoryCommand, Command:="GetKeyboardAssignments" End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#6
|
||||
|
||||
I found it, thanks. Everything looks so different.
I was able to copy my macro over and it works. Then I printed the key assignments for a document and it was in the list. Yay!! But I was not able to open Normal.dotm. How do I do that? Thanks I'm going to bed. I'll try your code tomorrow. |
#7
|
||||
|
||||
You can't open Word without having Normal.dotm open.
If your macro is in a particular template, you should put the keyboard shortcut in the same template. It doesn't make sense to split the two parts of the functionality into two different files.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#8
|
|||
|
|||
If you go into the dialog to Customize the Keyboard and press Ctrl+O it will show you the current assignment. Just type the shortcut into the box and it will show you. Unfortunately, it will not show you where a macro is stored, though.
Here is my page on moving customizations: Moving (Sharing) Customizations in Microsoft Word It is a lot easier if you put as much as possible into separate Global Templates. Here is an old but still very valid page on Organizing your Macros. Organizing your macros by Beth Melton, Word MVP Here is a newer one: Install/Employ VBA Procedures (Macros) by Greg Maxey There is no way built into the User Interface in Word to transfer keyboard shortcuts. With the 32-bit version of Word, Chris Woodman created an Add-In that still works for that. You can download it from my downloads page or from his site. Chris Woodman's Keyboard Shortcut Organizer As was mentioned earlier, you want to have the shortcut stored in the same template (or document) that holds the macro. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importing Macros from 2007 with keyboard shortcuts | gyro2222 | Word VBA | 19 | 03-02-2015 09:33 AM |
Keyboard shortcuts not displaying (Word 2007) | Jennifer Murphy | Word | 5 | 12-10-2014 07:01 AM |
Is there a way to list all keyboard shortcuts? | Jennifer Murphy | Word | 1 | 08-02-2012 01:48 PM |
Can I turn off keyboard shortcuts? | martinlest | Outlook | 1 | 06-10-2012 09:49 PM |
Impermanent keyboard shortcuts | Subligaria | Word | 2 | 11-01-2011 12:41 PM |