Discussion:
Initiating Macros when Word is started from a script
(too old to reply)
Colin
2006-01-19 16:52:59 UTC
Permalink
All,

I have produced some very simple macros that are linked to application
events. I have created this following the instructions found at
https://word.mvps.org/FAQs/MacrosVBA/AppClassEventsContent.htm
I put these in a template that I have stored in my Word startup
directory so that theyare always run.

I then initiate Word from a VB script in another application (Excel for
example).

Dim word As word.Application
Dim doc As word.Document
Set word = New word.Application
Set doc = word.Documents.Add("C:\test.dot")
doc.PrintOut
word.Quit (False)

This does not seem to initiate the macros that are held in my addins
template.
Am I missing something?

I am using Word 2003 on XP.

Thanks in advance for any assistance.

Colin
Doug Robbins - Word MVP
2006-01-19 22:04:39 UTC
Permalink
From experience, I have learnt that application events may not be properly
loaded if:

1. Word is set as the email editor in Outlook and Outlook is started
before Word

2. Word is started by double clicking on a document in Windows Explorer
or on the desktop

Quite likely, you are running up against the same issue.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Post by Colin
All,
I have produced some very simple macros that are linked to application
events. I have created this following the instructions found at
https://word.mvps.org/FAQs/MacrosVBA/AppClassEventsContent.htm
I put these in a template that I have stored in my Word startup
directory so that theyare always run.
I then initiate Word from a VB script in another application (Excel for
example).
Dim word As word.Application
Dim doc As word.Document
Set word = New word.Application
Set doc = word.Documents.Add("C:\test.dot")
doc.PrintOut
word.Quit (False)
This does not seem to initiate the macros that are held in my addins
template.
Am I missing something?
I am using Word 2003 on XP.
Thanks in advance for any assistance.
Colin
Tony Jollans
2006-01-20 00:58:10 UTC
Permalink
As far as I know, auto macros don't run when Word is started via Automation.

--
Enjoy,
Tony
Post by Colin
All,
I have produced some very simple macros that are linked to application
events. I have created this following the instructions found at
https://word.mvps.org/FAQs/MacrosVBA/AppClassEventsContent.htm
I put these in a template that I have stored in my Word startup
directory so that theyare always run.
I then initiate Word from a VB script in another application (Excel for
example).
Dim word As word.Application
Dim doc As word.Document
Set word = New word.Application
Set doc = word.Documents.Add("C:\test.dot")
doc.PrintOut
word.Quit (False)
This does not seem to initiate the macros that are held in my addins
template.
Am I missing something?
I am using Word 2003 on XP.
Thanks in advance for any assistance.
Colin
Loading...