Save As Macro

M

Max2073

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
 
D

Dave Peterson

Application.displayalerts = false
'your code to save
application.displayalerts = true
 
M

Mike H

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.
 

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