1
votes

I have written a macro (Foo) in Word VBA that I will use to manipulate data in other Word documents.
I have stored Foo in its own file (MyMacro.docm), not the Normal.dotm file.
I have found that I can't access my macro Foo from the Word datafiles I wish to manipulate (e.g. Datafile.docx), even if 'Macros in all active templates and documents' is selected.

Is it possible to access Foo from Datafile.docx, and if so, which options do I need to change?

Thanks, Freda


This is what I did to run Foo on the data in the file 'Datafile.docx':
1. Open Word
2. Open MyMacro.docm, enable macros
3. Confirm 'Foo' is available to run from MyMacro.docm - it is
4. Open Datafile.docx
5. Open the list of macros available to run on Datafile.docx - Foo is not available to run on Datafile.docx
6. Press Alt-F11 to access the VBA editor from Datafile.docx - Foo is clearly shown in the modules listed under the MyMacro.docm document.

I tried changing Datafile to a macro-enabled document (Datafile.docm), but it didn't solve the problem.

1

1 Answers

3
votes

Could you load "MyMacro.docm" as a global template? From Word, click Developer -> Document Template -> Add -> "MyMacro.docm". The macro will be available in the macro list (hit Alt+F8 to view) or from VBA code:

Application.Run "Foo"