Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having problems saving a Word Doc in .Txt format
Message
 
À
13/10/2000 09:49:24
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00429019
Message ID:
00429032
Vues:
18
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform