View Single Post
  #8   Report Post  
Vic Spainhower
 
Posts: n/a
Default

Cindy,

Thank you for your explaination - it is very clear to me now why it was
failing! I knew that it had something to do with a reference and I was using
Process Explore to attempt to see what it was but not successfully.

You help is very much appreciated.

Vic



"Cindy M -WordMVP-" wrote in message
news:VA.0000a3cb.0025c520@speedy...
Hi Vic,

Thank you very much for the answer, I now have it resolved. I had already
done all of the things that you mentioned except the changing
"ActiveDocument" to WordDoc and I was still getting the error. After this
final change it now works correctly.

I use this same code in VBA and I've never had this problem. Why would
that
be?

I'm not certain, but it probably has something to do with how object
variables
(don't) go out of scope. Take a look again at the code you posted: you
tell
VB6 to use ActiveDocument, but you don't tell it where to find
ActiveDocument,
so VB6 has to guess (it should be WordApp.ActiveDocument). And in order to
make the association, it probably has to build another connection to the
Word
application in the background - one to which you have no access and
therefore
can't clear.

When you use ActiveDocument in Word you don't have to qualify it with the
application object. Word *knows* you mean it to work locally.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)