Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Need help with word automation syntax
I am a newbie to doing word automation. I am having trouble with the syntax for executing some of the methods. I have seen the documentation on MSDN (as discussed in other threads)
This is what I want to accomplish:
1) I have a 'base' word document. It has mostly fixed text, but some variable text. Most of the variable text is in tables. Some is embedded within a paragraph.
2) I want to copy the base document to another temp document and then open the temp document with word automation.
3) I want to write changes to the variable text and save the temp document.
4) I want to print the temp document via word automation.
I am good with steps 1,2 and 4.
How can I access and write to individual cells in the table. How can I change other variable text that is not in a table.
The online documentation on MSDN gives an example of making a document the active document:
Documents("MyDocument.doc").Activate
What is the VFP equivalent for this?
I already have:
oWord=CREATEobject("Word.Application")
lcfilename='execsum\'+'execsummain3.doc'
oWord.Visible= .t.
oDoc=oWord.Documents.Open(lcfilename)
** the above works
** next i want to activate the document, and write changes to a table cell
** the code below doesnt' work
odoc.activate("execsummain3.doc") && error ole error code 80020011 - does not *support a collection
wait wind odoc.activedoc.tables(1).cell('Row:=1', 'Column:=1')
** get activedoc is not an object (or similar)
**what should the syntax be for activating the document, writing changes to the
** table
***********************
**this works
odoc.close()
oword.quit(0)
TIA
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement