Apr 19 2021 06:39 AM - edited Apr 19 2021 06:46 AM
Apr 19 2021 06:39 AM - edited Apr 19 2021 06:46 AM
I want to be able to create a new Word document that has my usual set of macros & keyboard shortcuts enabled. I'm having trouble doing that.
I made a Normal.docm template. I called it MacroTemplate & made it so that it shows in the set of templates that appear when I click File > New.
I create a new doc based on that template. The macros show in the document. I can select them & run them. The keyboard shortcuts show in Customize Keyboard, but do not work to run macros.
I have a clunky work-around that I can do to get them to work, but don't want to have to do this step every time that I create a new document. I always want every new document to be created with this set of macros enabled with working keyboard shortcuts!
An example is my InsTodayDate macro with a keyboard shortcut of Alt+D.
A way that I can get them to work is to go into the Macros Organizer. In my Normat.docm template, there is a set of macros called NewMacros. This set already exists in my current document. They don't show in this Organizer, but they are there when I list the macros in the document. I can use the Organizer to copy the NewMacros to my current document.
Result: My keyboard shortcut now works. Now, in the Organizer, my current document lists all of the macros twice. The macros were not listed in my current document in this dialog before. Now they are listed twice. I have 46 macros I'd like in the document. Now it lists these twice - so there are now 92. One set of 46 is prefixed with Normal.NewMacros.[macroname]. The next set of 46 is prefixed with Project.NewMacros.[macroname] - which rather proves that the macros were already there to begin with.
Interestingly - the Customize Keyboard dialog does not show them twice. It lists only the macro names - a single set of 46.
How can I create a new document that is macro-enabled and includes my macros & their working keyboard shortcuts? (just like Word 2003 did - which is what I am moving from)
Apr 20 2021 06:07 AM - edited May 24 2022 08:01 AM
I would suggest that you start with creating a true template with the *.dotm extension. (A macro-enabled document, *.docm, is still just a document.)
Since you are using the name "Normal," are you trying to replace Word's predefined Normal.dotm template? That isn't a good idea. You can customize the Normal template or you can use some other template (with a different name) and load it as an add-in, by putting it in Word's Startup folder.
Apr 20 2021 06:30 AM
Apr 22 2021 12:49 PM
Feb 14 2022 09:14 AM
@Stefan_Blom Was there ever a resolution to this question? I am experiencing the same issue as Susan. The issue seems to have started with the migration to Windows 11. Keystroke shortcuts for my custom macros (part of the Normal template) show up in File->Options->Customize Ribbon->Customize keyboard shortcuts (button). However, the keyboard shortcuts do NOT work! However, I am able to manually run the macros through the Developer->Macros dialog box. Please help!
Feb 14 2022 09:49 AM
Are you saving your macros to the Normal template? Are you also saving the shortcuts in that same template?
I have no idea if the original poster in this thread found a working solution, unfortunately.
Feb 14 2022 10:28 AM - edited Feb 14 2022 10:29 AM
@Stefan_Blom Yes, I am saving my macros to the Normal template--at least I think that is the case. I am creating the keyboard shortcuts using a macro like this:
'CreateBookShortcuts 'Assigns convenient shortcut keys to the book macros Sub CreateBookShortcuts() CustomizationContext = NormalTemplate KeyBindings.Add _ KeyCode:=BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyH), _ KeyCategory:=wdKeyCategoryCommand, _ Command:="FormatHTMLTag" KeyBindings.Add _ KeyCode:=BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyP), _ KeyCategory:=wdKeyCategoryCommand, _ Command:="FormatCSSProp" KeyBindings.Add _ KeyCode:=BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyV), _ KeyCategory:=wdKeyCategoryCommand, _ Command:="FormatCSSVal"
This macro is part of a module `BookMacros` that lives in the Normal' template's 'Modules' folder. When I inspect keystroke shortcuts through File->Options->Customize Ribbon, I see that the keystroke shortcuts I have defined do indeed show up:
However, the keystroke shortcuts do NOT work!! The only way I can get them to run is to manually run them from the Developer->Macros dialog.
This is really strange. These shortcuts worked fine previous to my recent transition to Windows 11.
Thanks in advance for any help you can provide.
Note: I have tried "Reset Macros..." and then re-running the macro to redefine the keystroke shortcuts. However, that didn't work.
May 24 2022 07:37 AM - edited May 24 2022 07:38 AM
I have the exact same issue. The strange thing is that at 6 AM today, they (the macros with shortcut keys assigned) worked perfectly. At 7:35 AM, the shortcut keys to the macros stopped working. Strange thing is that I can still run my other shortcut keys assigned to styles (i.e., Heading 1, Heading 2, etc.) and other predefined functions in the MS Words. Just can't run them with my own macros anymore.
May 24 2022 08:04 AM
Are you running Word for Windows?
Are the macros and their shortcuts stored in the same template? Is the template with macros loaded as a global template or accessed by other means?