View Single Post
  #5   Report Post  
Roger
 
Posts: n/a
Default

thanks for that

"Peter Rooney" wrote:

Roger,

Two ways to accomplish this (see below)

The neatest way is to use "Application.DisplayAlerts=False" command before
your save commands

Alternatively, you can use SENDKEYS to send a "Y" (or whatever character you
want) before your save commands.

Sub SaveAll()
Application.DisplayAlerts = False
'BookName1 = "D:\Pete's Operations\Impacts\Impacts Database - " &
Format(Date, "yy-mm-dd") & ".xls"
'BookName2 = "F:\Systems Management\Impacts Database - " & Format(Date,
"yy-mm-dd") & ".xls"
BookName1 = "D:\Pete's Operations\01 Processes\Impacts Database.xls"
BookName2 = "F:\Systems Management\02 Impacts Database\Impacts
Database.xls"

'SendKeys "y"
'ChDir "D:\Pete's Operations\01 Processes"
ActiveWorkbook.SaveAs Filename:=BookName1, _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

'SendKeys "y"
'ChDir "F:\Systems Management\02 Impacts Database"
ActiveWorkbook.SaveAs Filename:=BookName2, _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

Hope one of these helps

Pete



"Roger" wrote:

How do I get the macro to answer "yes" automatically when the Excel dialog
box comes up with the message "file name already exists - do you want to
overwrite?"

The reason is becasue I've got a number of files to save automatically and i
don't want the user to have to keep hitting the "y" key.

--
Roger