General information
Category:
COM/DCOM and OLE Automation
>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?
Isn't wdFormatText a numeric constant?
In that case you have to convert it to string first
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only