2

tl;dr My Normal.dotm file contains one macro. But when I open it in Word 365 and create a new file based on that template or try to save that template under a new name then all resulting files has this macro stripped off (contains zero macros). Why? Is there any solution to this?P


My heavily modified Normal.dotm contains a macro:

enter image description here

Yet, any document created based on it has this macro stripped-off during opening:

enter image description here

Why, what am I missing?

I can save the document created based on that template in any format I wish:

  • .docx -- macro-free document,
  • .docm -- macro-enabled document,
  • .dotx -- marco-free template,
  • .dotm -- macro-enabled template

or I may leave it open in Word and not save it at all. No change and the effect is always the same -- macro is not there, stripped off during opening (probably).

I can save the file in any location I want (some people suggested that saving templates in specific folders is essential):

  • %appdata%\Microsoft\Word\STARTUP
  • %appdata%\Microsoft\Templates\
  • any other location

The same effect -- no macro in saved file.

When comparing existing Normal.dotm and saved Test.dotm I can clearly see ~7 kB difference in size. And comparing contents shows that macro-related files and data is not found in Test.dotm.

Trust Center configuration seems correct. All locations in which I store my templates is considered "safe":

enter image description here

And I have a setting to be warned when macro is disabled:

enter image description here

I am 99.99% sure that my problems are since I started using Office 365 off-line programs. I had never such problems in Word 2010 and Word 2013 used before.

What am I missing or how to workaround this problem? How to save a template with my macro or how to add a macro to already saved template?


EDIT: As requested in the comments here is a LICECap animation that shows that:

  1. The original template file has 27 kB.
  2. Renaming any style is possible and name change is retained after saving new template.
  3. Original template contains one macro, but document created based on it has no macros.
  4. Saving original template with just one style name change produces 13 kB only .dotm file.
  5. Saved new template has zero macros.

Here is the animation:

enter image description here

13
  • 1
    I would guess your macros etc. get already lost when opening the original file - not when saving. Check if the macro is there right after opening.
    – Aganju
    Jun 20 at 0:35
  • To my extreme surprise, you're correct. Normal.dotm contains one macro while Document1 (even before saving) doesn't have any macro. This is so weird. What can cause macros to be stripped off (and what is the reason for using macro-enabled templates, if macros are stripped-off even so?). Plus: your comment doesn't explain why custom keyboards shortcuts are lost as well.
    – trejder
    Jun 20 at 6:34
  • Try to save your .dotm template with the macros & custom keyboard shortcuts in the folder %appdata%\Microsoft\Word\STARTUP (it doesn't need to be named Normal.dotm).
    – harrymc
    Jun 20 at 7:32
  • @harrymc This brings no change. I'll have to rewrite the question entirely (following Aganju suggestion) to make it back on-topic.
    – trejder
    Jun 20 at 12:52
  • 1
    From MS pages Note: If Normal.dotm is renamed, damaged, or moved, Word automatically creates a new version (which uses the original default settings) the next time that you start Word. The new version will not include any of the customizations that you made to the version that you renamed or moved. So the idea: are you saving it in the expected path? If you modify only a style (e.g. Title) does it works? Q2: Are the 7kb more in Test.dotm? (you said the opposite).
    – Hastur
    Jun 23 at 12:31

2 Answers 2

2

You seem to have run against a new bug in Word 365 which ignores macros in templates.

I remark that Word treats Normal.dotm as a replaceable file, recreating it if deleted. A better place for templates is in the folder %appdata%\Microsoft\Word\STARTUP. Word is supposed to load automatically all templates from this folder, which, again, now doesn't work for macros.

For the moment, the most you could do is signal this bug to Microsoft via the Feedback Hub.

As your macros are mainly for text replacement, they could probably be replaced as workaround by AutoText rules or even by AutoHotkey macros. With more information I could perhaps help in that.

0

Could you disable Anti-Virus (maybe even an uninstall?) and test it again? Another idea: Create a second user on Windows, log in and test if everything happens, keeping Anti-Virus disabled. In the past, I've had some headaches with fake antivirus detection in a Word macro. This macro was dealing with add-ins and this is a sensitive region where viruses can attack. And antivirus software almost always checks Office documents for "viruses".

2
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 25 at 2:42
  • I will check your proposal. However, I don't believe that either anti-virus or even Word itself removes the macro silently, i.e. without any warning.
    – trejder
    Jun 26 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.