We are performing a mail merge from our Microsoft Access application.
When the application starts, it attempts to create a word object using
late binding via a call to CreateObject. The idea was that this
object would remain hidden and we would perform merges to it as
necessary. I have come across two problems. If the user starts our
application and then later invokes Microsoft Word, Word doesn't bother
to start another instance of itself. It just happily makes the
instance we had created visible instead of invisible. Well, I
thought, I will just create another instance if this happens. I can
easily iterate through all instances of Microsoft Word and determine
if the window is visible or invisible, but I cannot obtain a reference
back to these instances. Is the only way to obtain a reference back
to Microsoft Word via a call to GetObject(), or is there another,
trickier way that I am unaware of? I wouldn't have a problem with
GetObject, but for the fact it will return a random reference back to
one of the instances of Word. I can't guarantee that the reference it
returns will be to an instance of Word that is invisible. Any
suggestions? Thanks.
Vincent