What is the code to save over an existing file with no prompt


Posted by T on October 05, 2001 12:33 PM

I created a macro tat does several steps. One step is a Save As based on the value in cell I1. Here is the code I am using.

Dim rngeFileName As Range, sPath As String
Set rngeFileName = Range("I1")
sPath = "C:\RFP's\"
ActiveWorkbook.SaveAs sPath & rngeFileName.Value

If the value in cell I1 has not changed since the last save, what is the code I need to add to make the macro save over the existing file without prompting?
Currently I get the standard dialog box asking if I want to save over the existing file and I always click yes.

Thanks in advance.

Posted by Barrie Davidson on October 05, 2001 12:49 PM

Change your code to:

Dim rngeFileName As Range, sPath As String
Set rngeFileName = Range("I1")
sPath = "C:\RFP's\"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs sPath & rngeFileName.Value
Application.DisplayAlerts = True

The DisplayAlerts command turns off the pop-up alerts.

BarrieBarrie Davidson



Posted by T on October 05, 2001 1:00 PM

Thanks Barrie