Let's start over again with a simple scenario. Forget about the document
management system for the time-being and let's start with Word 2003 only.
Now my first objective is to fire off a macro, right after an existing word
document is opened by whatever means, double-click or right-click open from
windows explorer, or File Open from within Word 2003. This could possibly be
achieved by implementing a macro in AutoOpen(0 or Document_Open(), right?
Now assume the document may or may not be attached to a template. In
addition, a number of templates, let say 10, will also be loaded from the
default StartUp folder. OK?
This is the scenario I would like to simulate.
Many thanks,
Hi =?Utf-8?B?YXVzaGtub3Rlcw==?=,
> Let's start over again with a simple scenario. Forget about the document
> management system for the time-being and let's start with Word 2003 only.
If the document management system is installed and interfering with how Word
functions, you can't ignore it. I'm afraid that's the way it is. And such a
tool can interfere with how Word functions, so you may not see what I see if
it's present on your machine.
> Now my first objective is to fire off a macro, right after an existing word
> document is opened by whatever means, double-click or right-click open from
[quoted text clipped - 6 lines]
>
> This is the scenario I would like to simulate.
So I don't understand your question: what do you want to simulate?
AutoOpen in normal.dot will fire when a document is opened. The attached
template will also be loaded.
But the templates in the Startup folder:
1. Will be loaded only when Word starts (not every time a document is opened)
2. Will never run an AutoOpen (or AutoNew) macro they may contain
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 :-)
aushknotes - 29 May 2008 11:16 GMT
Hi Cindy,
I totally agree that the Document_Open() in the Normal.dot fires off
perfectly in a stand-alone installation. However, it doesn't fire off as
expected in a document management system environment. I think I have no other
altermatives but to discuss with those support guys to find out how their
system behaves. Thanks a lot for your info and your clarifications. They
really helps.
All the best!
> Hi =?Utf-8?B?YXVzaGtub3Rlcw==?=,
>
[quoted text clipped - 34 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Gordon Bentley-Mix - 29 May 2008 23:09 GMT
It's probably the DMS integration that's suppressing the execution of the
AutoOpen macro - kind of like setting macro security in Word to 'High'. In a
DMS like iManage the integration is usually provided through a global
template(called "iManO2K" in most cases) which does all sorts of stuff like
intercept the File | Save, load toolbars, etc. Your DMS techical guys (NOT
the sales guys - they won't know anything) should be able to tell you what
happens when a document is opened from within the DMS environment. Ask them
what else the DMS tells Word on an "Open" event - if anything.
Note that you may also encounter problems if you try to use an AutoNew macro
in a template under certain DMS configurations. If the template is stored in
the DMS and functionality is provided to create a new document based on this
template from within the DMS, the AutoNew macro probably won't fire either.
This is because many DMSs don't actually create a new document using Word
processes (i.e. execute a Documents.Add event). Instead the template (which
isn't _really_ a template - the DMS stores it as a .doc but calls it a
template) is copied within the DMS document repository, and then this copy is
opened. This usually happens when the DMS is set up to 'pre-profile'
documents and is designed to ensure that no documents can be created which
aren't stored in the DMS. And as discussed above, even using an AutoOpen or
AutoExec macro is no substitute because the DMS may block the code execution.
The best solution is to do all of your document creation processes in the
Word environment and then 'post-profile' the document when it's saved.
However, the decision to pre- or post-profile is usually made some policy
w.nk who doesn't have any technical nous. Consequently, you end up getting
caught by conflicting requirements: the template _must_ have code in it but
all documents _must_ be created in the DMS environment and the DMS won't let
the code run - and of course the DMS guys won't change their system to
accommodate the requirements, and the policy w.nk won't change the
requirements...
If you are dealing with sort of situation I suggest that you make a strong
case for going away from pre-profiling. You can write code that forces the
user to save the document as soon as it's created - well, not exactly
"forces" but certainly "strongly encourages". Just make the last line of your
code 'ActiveDocument.Save' and let the DMS take over from there.
You can also be a bit trickier about this. Usually the concern about
creating documents outside of the DMS environment is that the users will save
the document someplace other than the DMS or that they'll print the document
and then close it without saving. The DMS integration can handle the first
scenario by taking away the ability to save the document locally. However,
you can write code to address the second situation.
Create a procedure called 'FilePrint', which will intercept Word's File |
Print command. In this procedure just look at the Saved property of the
document and don't let the document print if it hasn't been saved - and of
course it can't be saved anywhere but into the DMS. You'll also need to
fiddle with the Print button on the Standard toolbar so it executes your
FilePrint macro.
Anyway, good luck in what I suspect will be a protracted battle. Hope you win!

Signature
Cheers!
Gordon
"I could write really great code - if it wasn't for the bloody users!"
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
> Hi Cindy,
>
[quoted text clipped - 45 lines]
> > This reply is posted in the Newsgroup; please post any follow question or reply
> > in the newsgroup and not by e-mail :-)