Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting a fields from one record into Word
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00449272
Message ID:
00449979
Vues:
36
Well, now Word gets launched, but this line says "member SELECTION does not evaluate to an object":
oRange = oDocument.selection.range()

I plan to pick up the book for the holidays :)

Thanks.


>Phil,
>
>PMFJI... Della is certainly the expert here, but I think you want the first line to be
oWord=CREATEOBJECT('word.application')
The application object contains the documents collection, which you can use to open a document as you're doing in your second line of code.
>
>BTW, Della and Tamar's "Office Automation" book is definitely a good investment if you're going to be doing much of this kind of work.
>
>-Rick
>
>>>Try this as the first four lines:
>>>
<b>oWord</b>=CREATEOBJECT('word.document')
>>><b>oDocument = oWord</b>.documents.OPEN('c:\qcf19.doc')
>>><b>oWord</b>.VISIBLE=.T.
>>>
>>>oRange = <b>o</b>Document.selection.range()
>>>
>>>The bolding indicates changed items. Mostly, I've renamed the object variables to clarify what object is reference, though I did add an oDocument object so you can track the document separately.
>>
>>I took your advice, and now have the code shown:
>>
>>
oWord=CREATEOBJECT('word.document')
>>oDocument = oWord.documents.OPEN('c:\qcf19.doc')
>>oWord.VISIBLE=.T.
>>oRange = oDocument.selection.range()
>>#DEFINE wdLine 5
>>
>>with oRange
>>.MoveDown(wdLine,1)
>>.TypeParagraph
>>.TypeParagraph
>>.MoveUp(wdLine,2)
>>.InsertDateTime("MMMM d, yyyy",.f.)
>>.TypeParagraph
>>.Typeparagraph
>>.TypeText (&l_address)
>>endwith
>>
>>I get an error on the second line (oDocument=oWord.documents.OPEN('c:\qcf19.doc') which says "Member DOCUMENTS does not evaluate to an object".
>>
>>(puzzled look)
>>
>>Thanks again for your patience and persistence :)
Phil Thomas
http://phillipdthomas.com

Never let your energy or enthusiasm be dampened by the discouragements that must inevitably come.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform