I have created a word object with a reference .. oWd
what is the syntax to open a word document.
oWd. ???????????????
Printable View
I have created a word object with a reference .. oWd
what is the syntax to open a word document.
oWd. ???????????????
search this forum for "Word automation" or "automate Word", this sort of thing is asked all the time - you'll get lots of useful tips for this and everything else you'll need to do with it once you have it open.
oWd.Documents.Open "Document Path"
heres a good tip
open up word, and record a macro of whatever you wanna do, then edit teh macro and youve pretty much got all the code you need in Vb right in front of you :)
Ok .. I have it all except one thing ..
comes up with a do you want to save changes...
how can I skip the conversation and just close the sucker as I am not making changes, I am only printing.
when you close Word (or just a document) you can pass a "save the changes" parameter, just set it to false, eg:
oWord.Close SaveChanges := False
thanks all...
use one of these depending on what you want
VB Code:
ActiveDocument.Close wdDoNotSaveChanges ActiveDocument.Close wdPromptToSaveChanges ActiveDocument.Close wdSaveChanges