Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2020, 07:12 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows XP Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2007
Competent Performer
Help moving keyboard shortcuts from 2007 to 2016 (365)
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Help moving keyboard shortcuts from 2007 to 2016 (365)

I have two basic questions:


  1. How can I find out what a keyboard shortcut is assigned to (including macros)?
  2. 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,
  1. Why didn't Word show that Atl+o was assigned to this macro?
  2. 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?
  3. Is there anything in this macro that won't run on Word 2016?
  4. 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
Reply With Quote
  #2  
Old 03-05-2020, 10:53 PM
Guessed's Avatar
Guessed Guessed is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows 10 Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,724
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

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
Reply With Quote
  #3  
Old 03-06-2020, 12:03 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows XP Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2007
Competent Performer
Help moving keyboard shortcuts from 2007 to 2016 (365)
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
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.
I don't understand what you mean by "go in to look for the macro name...". Can you be a little more specific, maybe with step-by-step instructions. Sorry to be so dense.

Or are you referring to printing them as described below?

Quote:
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'.
This is very helpful. I never knew this was available.

I tried File | Open | Trusted Templates. There are 4 listed. The last saved dates are in parens.
  • Normal11.dot (4/24/07)
  • Normal.dotm (3/05/20)
  • NormalEmail.dotm (1/03/17)
  • Standard Styles.dotx (10/07/19)

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
Reply With Quote
  #4  
Old 03-06-2020, 12:31 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows XP Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2007
Competent Performer
Help moving keyboard shortcuts from 2007 to 2016 (365)
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 03-06-2020, 01:02 AM
Guessed's Avatar
Guessed Guessed is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows 10 Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,724
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

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
Attached Images
File Type: png KeyboardAssignments.png (21.5 KB, 8 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old 03-06-2020, 01:12 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows XP Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2007
Competent Performer
Help moving keyboard shortcuts from 2007 to 2016 (365)
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 03-06-2020, 04:17 AM
Guessed's Avatar
Guessed Guessed is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows 10 Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,724
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

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
Reply With Quote
  #8  
Old 03-06-2020, 11:12 AM
Charles Kenyon Charles Kenyon is offline Help moving keyboard shortcuts from 2007 to 2016 (365) Windows 10 Help moving keyboard shortcuts from 2007 to 2016 (365) Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,655
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

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.
Reply With Quote
Reply

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
Help moving keyboard shortcuts from 2007 to 2016 (365) 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
Help moving keyboard shortcuts from 2007 to 2016 (365) 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft