SaveAs for an existing file

J

jimi

Hi

I'm writing a little script to convert a RTF file to a write-protected
DOC file. All works great, except if the DOC file already exists. I'd
like the script to assume that it should overwrite the existing file,
but I can't find where to do this! Here's my script so far:
-----
dim appWord
dim docWord

On Error Resume Next
Set appWord = CreateObject("Word.Application")
appWord.DisplayAlerts = False
Set docWord = appWord.Documents.Open("C:\temp\RTFTest.rtf")
docWord.SaveAs "C:\temp\RTFTest.doc", wdFormatDocument, , , , "test"

docWord.Close False

Set docWord = Nothing
appWord.Quit
Set appWord = Nothing
-----
Any ideas on what to do to this script to make Word assume the
overwrite the second time I run the script (ie. if C:\temp\RTFTest.doc
already exists).

Thanks
Jimi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top