Controlling Word externally using VB

TakedownCA

Senior member
Dec 18, 2000
305
0
0
Hi, I'm writing some new functionality into a standalone VB prog for work. I'd like it to open a particular Word file, modify some text fields (either text boxes or activex controls), print, and exit without saving. I tried plucking the necessary code by recording a macro from within the Word file, but the syntax/commands don't seem to be the same when you try to control Word externally. Any help would be appreciated.
 

TakedownCA

Senior member
Dec 18, 2000
305
0
0
Thank you. Those links were helpful. But after meddling about a bit more, it seems that my problem is specifically with the GetObject command. I want to use it to open an existing document, and then populate several fields using other methods/properties. However, whenever I try to run GetObject(path), I get an error (I believe a type mismatch error). I get an error (a different one) when I try to use GetObject to start a new instance of Word, as well. The only time GetObject seems to work is when there is already an instance of Word running. Thanks for any help.