Macros do not save in Normal.dot and must be reinserted

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Macros do not save in Normal.dot and must be reinserted

Post by jmt356 »

These are the steps I follow to put Macros in a module in Normal.dot:
- In Word, press Alt+F11 to activate the Visual Basic Editor (VBA);
- Click in Normal in the Project Explorer (the tree view on the left)
- Select Insert | Module.
- Type or paste the code into the window that appears.
- X out of the window, click save, and exit Visual Basic Editor.

However, every few weeks, I have to repeat the process and re-insert my Macros into Normal.dot. They do not appear to be saving properly. When I want to run a Macro, I normally have to reinsert it.

This is a personal computer and I am the administrator.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Macros do not save in Normal.dot and must be reinserted

Post by HansV »

After creating the macro, while the module in the Normal template is still active, press Ctrl+S. This should save the Normal template.
Quit and restart Word to test if the macro is still available.

If this doesn't work, there is something that deletes or overwrites the Normal template.
Regards,
Hans

User avatar
Doc.AElstein
5StarLounger
Posts: 1141
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Macros do not save in Normal.dot and must be reinserted

Post by Doc.AElstein »

This is more or less the same answer as Hans. I had the same problems as you , sometime worse, -( I got some weird results when saving a Template after doing changes to a macro )…
You must be in the VB Editor, and still be viewing / selected the macro you made or changed in the Normal document. Then you save from within the VB Editor, NOT from any document
SaveNormalInWordVBEditor.JPG : https://imgur.com/vuvM5Wm" onclick="window.open(this.href);return false;
SaveNormalInWordVBEditor.JPG
You do not have the required permissions to view the files attached to this post.
\ -_- / :heavy:

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Macros do not save in Normal.dot and must be reinserted

Post by jmt356 »

HansV wrote:After creating the macro, while the module in the Normal template is still active, press Ctrl+S. This should save the Normal template.
Quit and restart Word to test if the macro is still available.

If this doesn't work, there is something that deletes or overwrites the Normal template.
Doesn't clicking the Save icon do the same as pressing ctrl + s in the Visual Basic Editor?

Do I need to press ctrl + s before or after I X out of out of the code Window? I first X out of the code window, press Save and then X out of the Visual Basic Editor.

The macros usually stick for the first few days / weeks before they all disappear.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Macros do not save in Normal.dot and must be reinserted

Post by HansV »

The idea is to save the Normal template from the Visual Basic Editor, not from Word. I thought that would be clear from the way I and Doc.AElstein described it.

You are always going on about wanting to avoid using the mouse, so I gave you a keyboard shortcut. But yes, clicking the Save button is equivalent to pressing Ctrl+S, and also to selecting File > Save Normal (in this case).
Regards,
Hans

User avatar
Doc.AElstein
5StarLounger
Posts: 1141
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Macros do not save in Normal.dot and must be reinserted

Post by Doc.AElstein »

jmt356 wrote: Doesn't clicking the Save icon do the same as pressing ctrl + s in the Visual Basic Editor?.
I think Yes, 3 ways to do it, if you are in the VB Editor
File Save Normal Ctrl+S Save Button All in VB Editor.JPG : https://imgur.com/GnutIwq" onclick="window.open(this.href);return false;
File Save Normal Ctrl+S Save Button All in VB Editor.JPG
_.________________
jmt356 wrote:Do I need to press ctrl + s before or after I X out of out of the code Window? I first X out of the code window, press Save and then X out of the Visual Basic Editor..
Before. Stay in VB Editor and Save.

_:__________________________
jmt356 wrote:The macros usually stick for the first few days / weeks before they all disappear.
This sounds like a different problem. Something must happen to make them go away. I don’t have any guesses what might cause that. Hans said it - … there is something that deletes or overwrites the Normal template… I don’t have any guesses what that might be.
If macros usually stick for the first few days / weeks before they all disappear, then you have probably done the saving correct. Saving has worked. You did it correct. They did save. So later something must delete or overwrite the normal template. Sorry I can’t guess what that might be. Maybe someone else can.
You do not have the required permissions to view the files attached to this post.
\ -_- / :heavy:

User avatar
Charles Kenyon
3StarLounger
Posts: 284
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Macros do not save in Normal.dot and must be reinserted

Post by Charles Kenyon »

jmt356 wrote:
HansV wrote:After creating the macro, while the module in the Normal template is still active, press Ctrl+S. This should save the Normal template.
Quit and restart Word to test if the macro is still available.

If this doesn't work, there is something that deletes or overwrites the Normal template.
Doesn't clicking the Save icon do the same as pressing ctrl + s in the Visual Basic Editor?

Do I need to press ctrl + s before or after I X out of out of the code Window? I first X out of the code window, press Save and then X out of the Visual Basic Editor.

The macros usually stick for the first few days / weeks before they all disappear.
My experience is that I do not need to save code from within the VBE, but it does need to be saved. I usually do save it from within the VBE because that is the quickest way to be sure it is saved. It is very important where you are storing your code.

If I do not save it from within the VB Editor, I will be prompted when I close the Word session as to whether I want to save changes to the Normal template, if that is where I was doing the coding. If it was a document or that document's template other than the normal template I will be prompted when I close the document.
Attorney Charles Kenyon

Templates in Microsoft Word http://www.addbalance.com/usersguide/templates.htm
Modifying the QAT http://addbalance.com/word/QATmodification.htm