Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Automation Fails...
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Word Automation Fails...
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01094192
Message ID:
01094192
Views:
47
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.
Mark McCasland
Midlothian, TX USA
Next
Reply
Map
View

Click here to load this message in the networking platform