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