From: Mo on 7 Sep 2009 12:25 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
From: "Tony Jollans" My forename at my surname dot on 7 Sep 2009 12:59 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). -- Enjoy, Tony www.WordArticles.com "Mo" <Mo(a)discussions.microsoft.com> wrote in message news:08DDAF29-1DB0-4B84-BF1A-05D9788C18E3(a)microsoft.com... > 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
From: Mo on 7 Sep 2009 15:31 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 "Tony Jollans" wrote: > 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). > > -- > Enjoy, > Tony > > www.WordArticles.com > > "Mo" <Mo(a)discussions.microsoft.com> wrote in message > news:08DDAF29-1DB0-4B84-BF1A-05D9788C18E3(a)microsoft.com... > > 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 > >
From: "Tony Jollans" My forename at my surname dot on 7 Sep 2009 18:15 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. -- Enjoy, Tony www.WordArticles.com "Mo" <Mo(a)discussions.microsoft.com> wrote in message news:41AD727C-8E99-4767-A3D9-AAA17323AFC9(a)microsoft.com... > 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 > > > "Tony Jollans" wrote: > >> 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). >> >> -- >> Enjoy, >> Tony >> >> www.WordArticles.com >> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message >> news:08DDAF29-1DB0-4B84-BF1A-05D9788C18E3(a)microsoft.com... >> > 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 >> >>
From: Manfred F on 8 Sep 2009 04:03 Hi Mo, "Mo" wrote: ...> 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
|
Next
|
Last
Pages: 1 2 Prev: Which is faster - InsertAfter or Text= Next: If statement referencing a VBA Form |