Problem with AutoOpen macro running from an attached template

B

Beachie

I have a lot of documents that are customized by code every time they are
opened. For convenience's sake, I have written all of the code in one
template--let's call it "master code.dotm"--and saved the template. It
includes Public Sub AutoOpen. For each of my documents that need to use the
code, I have attached the template "master code.dotm." However, when I launch
any of my documents, AutoOpen does NOT run. *** Can anyone tell me how to
solve this? ***

I used to have Word's Trust Center macro setting set to enable all macros.
When this was the case, I could launch any of my DOCM files and AutoOpen
would run automatically. This proves (in my mind, anyway) that it's not a
problem with the location of "master code.dotm," permissions on the network,
etc. etc.

The ONLY thing I've changed is my macro setting. To make sure I have access
to the macros, I've done the following (with the help of our IT department):
1. Set up a digital certificate for me.
2. Signed my macro project in "master code.dotm."
3. Started up a Word document that contains macros, and when I got the
(nearly-invisible) prompt about macros, I picked to trust the signer. I trust
myself, what can I say.

When I open one of my documents now, NOTHING HAPPENS. And here's the kicker:
I can go to the macros (either in VBE or with Alt+F11), choose AutoOpen, and
IT RUNS. This lets me know that macros ARE enabled. And there are no other
macros named AutoOpen, etc. What gives?!
 
C

Cindy M.

Hi Brian,

How about if you go into the template's "ThisDocument" module, select the entry
"Document" from the list at the top-left of the code window, then "Open" from
the list at the top-right, and put your code into the Private Sub Document_Open
proc?

If that doesn't run, hold CTRL when starting Word to make sure *nothing* else is
loaded, then test again.
I have a lot of documents that are customized by code every time they are
opened. For convenience's sake, I have written all of the code in one
template--let's call it "master code.dotm"--and saved the template. It
includes Public Sub AutoOpen. For each of my documents that need to use the
code, I have attached the template "master code.dotm." However, when I launch
any of my documents, AutoOpen does NOT run. *** Can anyone tell me how to
solve this? ***

I used to have Word's Trust Center macro setting set to enable all macros.
When this was the case, I could launch any of my DOCM files and AutoOpen
would run automatically. This proves (in my mind, anyway) that it's not a
problem with the location of "master code.dotm," permissions on the network,
etc. etc.

The ONLY thing I've changed is my macro setting. To make sure I have access
to the macros, I've done the following (with the help of our IT department):
1. Set up a digital certificate for me.
2. Signed my macro project in "master code.dotm."
3. Started up a Word document that contains macros, and when I got the
(nearly-invisible) prompt about macros, I picked to trust the signer. I trust
myself, what can I say.

When I open one of my documents now, NOTHING HAPPENS. And here's the kicker:
I can go to the macros (either in VBE or with Alt+F11), choose AutoOpen, and
IT RUNS. This lets me know that macros ARE enabled. And there are no other
macros named AutoOpen, etc. What gives?!

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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