Loading order global templates in the startup folder

M

Mo

Hi all,
is there any way you can determine the order in which global templates
(those in the startup folder) are loaded. I thoght I'd read somewhere that
they were loaded alphabetically, but that does not seem to be the case. Word
2003/Windows XP.
What I want to do is to ensure that one global template is loaded before the
other. In the first template there is an application event (NewDocument) that
runs some code. Only after that code is run I would like other global
templates to fire their events and code.
Any help is appreciated,
Peeter
 
T

Tony Jollans

They seem to be loaded in reverse alphabetic sequence but I have never seen
anything documented and, so, it couldn't be guaranteed. There is even less
guarantee of the order of code running - exactly what happens will also
depend on the actual code. If you want to guarantee any kind of order of
events, you must control it yourself, from code - have one global template,
which loads others (and hope there is nothing in the Normal template,and
there aren't any COM AddIns, etc.).

However, DocumentNew Event code will not run until you create a new
document - which does not happen during normal startup (yes, Word does open
with a new document by default, but the event is not fired when it is
created).
 
M

Mo

Thanks Tony,

I was a bit unclear. I have a DocumentNew event on application level -
whenever a document is created the event fires. If another global template
also has the same type of event declared, it is also fired when a document is
created. So in this scenario you have two events fired whenever a new
document is created. What I have figured out, is that the order of those
events fired are based on the order of the templates loaded. I'll look into
the reverse alphabetical order, that you mentioned. I really can't let one
global load the other as I'm not sure I'm aware of all global templates that
could be around.
So i'm still looking for the fool proof solution :)
/Peeter
 
T

Tony Jollans

I don't think there is a foolproof solution unless you have total control of
the environment, which it sounds like you haven't. I also don't think you
should be trying to overrule every other AddIn that may exist - what is it
that you are trying to do to every new document, that is so sensitive?
perhaps there's another way.
 
M

Manfred F

Hi Mo,

:

...> So i'm still looking for the fool proof solution :)

to get a foolproof solution in an event-oriented environment, You are NOT
ALLOWED to make any assumptions on the sequence of events of the same type
fired by different Add-Ins.
If You need coordination, You have to use mechanisms like a semaphore, e.g.
implemented as a global variable or file. Maybe timer events could also be
helpful for Your task..

Kind Regards,

Manfred
 
M

Mo

Thank you all for your contribution. Maybe some checking for a flag and the
use of a timer colud do it.
/P
 

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