Hi Andrew,
If you are also looking for a good resource (and plan to do much of this stuff), I would get "Microsoft Office Automation with Visual Foxpro" by Tamar Granor and Della Martin (
www.hentzenwerke.com). It is a few years old but so far (I am currently using it), it seems to work fine with the Word object model (probably because I am just doing basic stuff). Well written with lots of helpful stuff.
In answer to your question more specifically, after instantiating your Word object, here is the basic code to start doing what you wanted:
STORE CREATEOBJECT("Word.Application") TO loWord
oWord.Documents.Open("C:\Empower\System\Personnel P\EMPOWER\Applicant - Offer.doc")
oWord.Selection.WholeStory
oWord.Selection.Copy
oWord.Documents.Add()
oWord.Documents.Paste()
The article that Mike cited I am sure covers this but I figure I should "give something back" for those who have helped me out lately!
Gotta go...phone call just came in.
Albert
>Hello Everyone,
>
>An age old question (probably). I need to drive Word to manage some documents. I've records a macro in Word to open a document, select all the text and copy it, create a new document and paste the text in:
>
>Sub Macro1()
>'
>' Macro1 Macro
>' Macro recorded 4/11/2008 by Development
>'
> ChangeFileOpenDirectory "C:\Empower\System\Personnel P\EMPOWER\"
>
> Documents.Open FileName:="""Applicant - Offer.doc""", ConfirmConversions:= _
> False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
> PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
> WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
>
> Selection.WholeStory
> Selection.Copy
> Documents.Add DocumentType:=wdNewBlankDocument
> Selection.PasteAndFormat (wdPasteDefault)
>
>End Sub
>
>
>How would I do this in VFP after I create a Word.Application object? Any help or pointers to resources is appreciated.
>
>Cheers,
>
>Andy