Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Permission error when saving a file - WORD
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Permission error when saving a file - WORD
Divers
Thread ID:
00756484
Message ID:
00756484
Vues:
53
I am trying to build in some protection in a simple Word automation program that opens an existing doc as read-only, then saves the document under a different name to a new location as a text file. Everything works fine, unless the document has been opened by somebody else on the network. The file will open, seemingly without a problem, but cannot be saved. An OLE error message is returned stating that the file cannot be saved due to a Permissions error.

Here is the code:

oWord = CREATEOBJECT('Word.Application')
oDocument = oWord.Documents.Open(D:\xfilename.doc,.f.,.t.) && open as read-only
oWord.ActiveDocument.SaveAs(c:\Newfilename.rtf,100) && where 100 is constant for RTF
oWord.ActiveDocument.close
...

The error message is "OLE(Dispatch exception code 0 from Microsoft Workd: Word cannot complete the save due to a file permission error. (c:\Newfilename.rtf)."

If would like to find out how to go ahead and save the file, if possible. If not I would like to learn how to test the file when it is opened (or before) to avoid the blow up.

Thanks much for any help you can provide.

Margaret
Margaret Duddy
mmd@outformations.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform