@Hans. Hi and thank you.
1) So a paragraph (and a sentence, etc.) doesn't have an 'Index', unlike Excel objects? I ended up using an artificial index variable x, with 'x = x + 1' within my loop.
2) Word Help wasn't very helpful in letting me know that 'Selection' applies to a Window object
, so thank you. I was (eventually) looking for a way to avoid 'Selection' as much as possible: I now understand that 'Range' is the way to go
http://msdn.microsoft.com/en-us/library ... 11%29.aspx.
3) I had already considered the two code snippets you posted
(although I used the variable name 'newDoc' he, he). I was then considering examining the 'AttachedTemplate' but this would still carry the same concerns. I was arriving at the solution you indicated: use the triggered event to store a reference to the ActiveDocument.
But if code is called from a toolbar or macro then the issue arises again
. I suppose in this instance the nearest I could get would be to check the 'AttachedTemplate' and if it's not the correct one then to check this for each open document - then to store a reference to the found document.
The only other approach that (just) occurs to me is to use the New event for the template to set a global variable. I wonder how this is referenced(?) - possibly
Documents(x).MyGlobalVar
One would think there should a simple (or simpler) solution to this.. Regards, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.