SaveAs : Suppress Replace file dialog box

W

Wesley

Hi, I am useing the SaveAs method in Excel. When I want to save the document
over another one I get the following message:
"A file named 'C:\file.' already exists in this location. Do you want to
replace it?"

I want to suppress this dialog box and overwrite the file. I don't see an
option in the SaveAs properties do do this.

Thanks.
Wesley
 
M

Macka

Hi Wesley!
Try this.

Sub SaveDontAsk()
'Active workbook other than this
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\MyTestFile.xls"
End Sub
 
W

Wesley

Thanks Macka

It worked like a charm

Macka said:
Hi Wesley!
Try this.

Sub SaveDontAsk()
'Active workbook other than this
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\MyTestFile.xls"
End Sub
 

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