What does auto run on opening/loading .dot file when Word already runs?

R

RB Smissaert

Still not solved the problem of setting references on opening/loading a .dot
file and I think I have to rephrase
my question.
What do I have to do to make code run automatically on opening/loading a
..dot file (not Normal.dot) when
Word already is running? AutoExec and AutoOpen don't seem to do it, so are
there any other options?
Thanks for any advice.

RBS
 
T

Tony Jollans

AutoExec should run when loading an AddIn (global template).
AutoOpen should run when opening a template as a document
AutoNew should run when creating a document from a template.

Which is it that you are doing? Where is your code? And what are your
security settings?
 
R

RB Smissaert

I have a Word .dot file (not normal.dot) that has in a normal (not a class-
and not a form-) module:

Sub AutoExec()
'startup code to run
End Sub

The code here should set references for the .dot file, so this is doing
Tools, References and
ticking references, but then programmatically, not manually.
Now AutoExec won't run if Word was already running for example in/as the
Outlook application.
So, how in this situation (Word already running) do I run startup code for
that .dot file?
Security is not the problem as that has been set low.

RBS
 
T

Tony Jollans

Unfortunately problems of this sort when did arise when Word was used as the
editor in Outlook. It is partly for this reason that the way it works was
changed in Word 2007.

Assuming it's a global template, the AutoExec will run when it's first
loaded EXCEPT that it will be suppressed if it's first loaded inside
Outlook. There really isn't any easy way to automatically do anything about
this, I'm afraid.
 
R

RB Smissaert

After a lot of experimenting I think the best and simplest option is to have
a Sub
that adds the references and saves the .dot file, save the .dot file without
the references
and tell the users on first use to run this Sub. This won't work when one of
the references
has changed as then there will be a broken reference, which I haven't
managed yet to remove
or fix programmatically, so then they will have to replace the saved file
with the original file
(the one without the references) and then run that Sub again.
All a bit messy, but I haven't anything better yet.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top