-
I ve tryed, but...
'I've tried, and found out that even if ObjWord points to correct application
'and mObjDoc is correct too, the Selection object seems to point always at
'first doc as you said (this is clearly a Microsoft bug).
'The only solution I found out is to do all at firs instance of word, that
'means: if you have several instances of word, you can add your new doc from
'your template at first of it.
'While if you want to look for all word applications opened, you'd better use
'enumwindow api and/or findwindow to switch focus to each (but I have not tryed
'to pass values).
'The first solution is rewrited below following your code
on error resume next
Err.Clear
'if it exist, get word
set objWord = GetObject(, "word.application")
If Err > 0 then
'if it does not exist, create a new one
set objWord = CreateObject("word.application")
Err.Clear
End If
on error GoTo 0
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
-
Re: I ve tryed, but...
Thanks for trying and proving to me that I'm not loosing my marbles!
I've just been playing with the range features and managed to do what I want with them as you can set them to be document specific. I was about to post a message saying so.
Again, thanks
Robin