I have two basic questions:
- How can I find out what a keyboard shortcut is assigned to (including macros)?
- How can I move a macro over to Word 2016?
I am in the process of migrating from Win XP and Office 2007 to Win 10 and Office 365. One of my problems is moving my beloved keyboard shortcuts over.
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,
- Why didn't Word show that Atl+o was assigned to this macro?
- More importantly, what's the best way to move this macro over to Word 2016? In Word 2007, I created a code module under Normal called MyMacros. Can I just do that in Word 2016 and copy all of my macros there?
- Is there anything in this macro that won't run on Word 2016?
- Where can I find a list of things that I need to change in migrating my macros from 2007 to 2016?
Thanks
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