Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Having problems saving a Word Doc in .Txt format
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?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement