>I am trying to use Word 7.0 as an ole server from within Visual Foxpro 30b
>to do so i give these commands (Can be done in command venster).
>
>lcWordobj = CREATEOBJECT('Word.Basic')
>lcWordobj.Appshow
>lcWordobj.FileNew
>lcWordobj.Fileclose
>lcWordobj.appclose
>
>a new file is created No problems at all.
>
>But now i want to create a new file based on existing templates which can be found from within VFP
>
>lcWordobj = CREATEOBJECT('Word.Basic')
>lcWordobj.Appshow
>lcWordobj.FileNew.Template = 'FAX.DOT'
>
>The following error occurs:
>FileNew does not evaluate to an object member
>
>A new file is created in word but not based on the fax.dot but on normal.dot
>
>I've tried to find the answer to this here:
>1 Developer Network cd
>2 Wrdbasic help from word 7.0
>
>None of these came up with the answer any ideas anyone
Word will inherit the properities of a template automatically. Issue the commands
oword=CreateObject("Word.Basic")
oword.FileNew("TemplateName" ) && The name of the template you want to use
This uses words basic functionality to create a new document based on the template.
When you are done with the document, you can print with the command
oword.FilePrint
or save the file to a new name with:
oword.FileSaveAs("mynewfile.doc")
Notice the slight diifferences to VFP's use of the word basic systax. Shorten the commands so that last variable is referenced as an variable within the object. Once you learn this difference VFP is faster and easier that Visual Basic and C++.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only