#1
|
|||
|
|||
Macro not starting from other documents
Hallo,
This Code Code:
Private Sub document_contentcontrolonenter(ByVal ContentControl As ContentControl) MsgBox "Hallo, I am " & ContentControl.Tag End Sub When I click within the document the check box with the Tag "Martin" the message comes with "Hallo, I am Martin" Please see attached file. The template is saved in AppData\Roaming\Microsoft\Word\STARTUP Any macros in any dotm-documents is this directory work with all documents. This macro does not. Why is that so? How can I make it enable for all documents? Best regards, Martin |
#2
|
||||
|
||||
The reason it doesn't work is that the macro is in the ThisDocument module, and 'ThisDocument' is the template itself, so it will only work for actions that relate to the template. Thus it works for the CC in the template body, but not for other documents.
See http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm which explains how to write application event procedures.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
After reading your link and other sites, this seems too complicate for me, however it is an interesting topic.
Thank you for your help, gmayor. Regards, Martin |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Microsoft Word 2013 Documents open as full version documents on two computers sporadically | Jaydenc-Fortress | Word | 2 | 08-07-2014 12:34 AM |
Macro for find/replace (including headers and footers) for multiple documents | jpb103 | Word VBA | 2 | 05-16-2014 04:59 AM |
Excel stops responding after starting macro | Catalin.B | Excel Programming | 2 | 09-07-2012 04:05 AM |
merging documents in macro page no | Rose_Garden | Word | 1 | 03-31-2012 04:50 AM |
Starting Over | zoeshaus | Outlook | 4 | 06-16-2010 12:20 PM |