I need to open a doc from an Access form. Works fine, except the doc's
AutoOpen does not run. Here's the code:
Dim oWord as Object
Set oWord = GetObject("C:\Data\Merge1.doc")
oWord.Application.Visible = True
This creates a minimized instance of Word with the named doc open. The
prompt to enable/disable macros does appear, but the AutoOpen does not run.
It runs fine when opened from Word File Open or by double clicking its name.
The AutoOpen is in the doc, not normal.dot.
What the Auto does is reset merge data source to an Access file in the local
directory. Any suggestions?
Auto macros do not run when starting Word using Automation. You must
explicitly run them ..
[Document_Ref].RunAutoMacro wdAutoOpen
--
Enjoy,
Tony
> I need to open a doc from an Access form. Works fine, except the doc's
> AutoOpen does not run. Here's the code:
[quoted text clipped - 12 lines]
> --
> Ted
TedMi - 19 Sep 2006 17:35 GMT
Thanks for the answer. Auto macros run SOMETIMES under Automation. I changed
my code to this, and AutoOpen runs!
Dim oWord as Object
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
oWord.Documents.Open FileName:="C:\..."

Signature
Ted
> Auto macros do not run when starting Word using Automation. You must
> explicitly run them ..
[quoted text clipped - 24 lines]
> > --
> > Ted