Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having problems saving a Word Doc in .Txt format
Message
From
13/10/2000 09:49:24
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Having problems saving a Word Doc in .Txt format
Miscellaneous
Thread ID:
00429019
Message ID:
00429019
Views:
54
I am creating an app which is going to open a Word Document, and save it as a textfile... however I can't get the .SaveAs Command to work! I have tried it many ways, but it is missing something... here is a snipett of my code:

DocName = "USPI Report 10-06-00.doc"
InputPath = "C:\MyProjects\SettlMgr\Incoming\"

oWord = CREATEOBJECT("Word.Application")
oWord.VISIBLE = .T.
DocToGet = InputPath + DocName
oWord.Documents.OPEN(DocToGet)
MyDocName = oWord.ActiveDocument.NAME
IF TYPE(MyDocName) = "L"
=MESSAGEBOX("File Did Not open Properly",0)
ELSE
MyDocName = SUBSTR(MyDocName,1,LEN(MyDocName)-4)
MyDocName = MyDocName + ".txt"
*- This returns Type Mismatch
oWord.ActiveDocument.SAVEAS
("'FileName:='+myDocname)", "'FileFormat:='+(wdFormatText)")

*- This Returns "This is not a Valid Filename
oWord.ActiveDocument.SAVEAS
("'FileName:='+MyDocname), 'FileFormat:=' + (&wdFormatText)")

*- This returns Type Mismatch
oWord.ActiveDocument.SAVEAS("FileName:="+myDocname), "FileFormat:=wdFormatText")

*- This returns Type Mismatch
oWord.ActiveDocument.SAVEAS("FileName:=&MyDocName", "FileFormat:=&wdFormatText")

ENDIF

What is the proper syntax for the ActiveDocument.SaveAs when using FoxPro?
Next
Reply
Map
View

Click here to load this message in the networking platform