简体   繁体   中英

Macros in document (not template) not visible in Word, but VBA-code is in place

Using Win10 and Word 2016.

I have made a Word template with macros (.dotm). When I create a new document (.docm) based on this template all the code (except ThisDocument) is copied from the template to the document.

But these macros are not visible in Word when i reopen the document: I open the macro-window (alt+F8) and if I in the list at the bottom choose the active document (not 'All...' or the template) none macros are shown. The macrolist is empty.

The shortcuts to the macros doesn't work either.

But if I create a new macro and go back to the macro-window (alt+F8) all the macros are there as they should be. And the shortcuts work.

Why does this happen? And more important: How can I make sure that the macros are visible and the shortcuts work immediately when someone opens the document?

It seems to be the case with all documents based on the template, om whatever computer.

I have found a solution. If I change the attached template to Normal the document's macros appear as they should.

Very strange. But nice to know.

I had the same problem, but the solution was different. When I went to the Template options (File | Options | Add-Ins then choose Templates from the "Manage" dropdown and click "Go"), my dotm file was listed but there was no tick in the checkbox next to it, so it was not loading automatically.

I checked the box next to the macro file name, restarted Word, and bingo, my macros all reappeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM