From: Max2073 on
I have created a macro that I use weekly. The macro names and saves the
spreadsheet.

Currently, when saving the spreadsheet I am asked "A file name
'c:\filename.xls' already exists in this location. Do you want to replace
it?"

Is there a way that I can amend the macro to automatically answer YES.

ActiveWorkbook.SaveAs Filename:="c:\filename.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Thanks
From: Dave Peterson on
Application.displayalerts = false
'your code to save
application.displayalerts = true



Max2073 wrote:
>
> I have created a macro that I use weekly. The macro names and saves the
> spreadsheet.
>
> Currently, when saving the spreadsheet I am asked "A file name
> 'c:\filename.xls' already exists in this location. Do you want to replace
> it?"
>
> Is there a way that I can amend the macro to automatically answer YES.
>
> ActiveWorkbook.SaveAs Filename:="c:\filename.xls", _
> FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
> ReadOnlyRecommended:=False, CreateBackup:=False
>
> Thanks

--

Dave Peterson
From: Mike H on
Hi,

Try this

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:="c:\filename.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Max2073" wrote:

> I have created a macro that I use weekly. The macro names and saves the
> spreadsheet.
>
> Currently, when saving the spreadsheet I am asked "A file name
> 'c:\filename.xls' already exists in this location. Do you want to replace
> it?"
>
> Is there a way that I can amend the macro to automatically answer YES.
>
> ActiveWorkbook.SaveAs Filename:="c:\filename.xls", _
> FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
> ReadOnlyRecommended:=False, CreateBackup:=False
>
> Thanks