Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation Fails...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01094192
Message ID:
01094201
Vues:
7
>Using Word 2003. Can anyone explain why the following works when executed from the Command Window ...
>oWord = newobject('word.application')           && returns an object
>oDoc = oWord.Documents.Open('WorkingFile.doc')  && returns an object
>loRange = oWord.ActiveDocument.Range(0,0)       && returns an object
>loRange.Find.Execute('OldVal', , , , , , .T., , , 'NewVal', , , , 2) && returns .T.
>oWord.Visible = .T. && I can visually verify the replace occured
>
>... but fails when I run it from a PRG? The only difference is the code above is in a PRG class and all the variables are now properties of the class (e.g., THIS.oWord, THIS.oDocument). loRange is just a variable created in a method.

Try oDoc = oWord.Documents.Open(getf('doc'))
if that works, it's a pathing problem to the document. You may need the fully qualified path.
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform