Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Roger
 
Posts: n/a
Default Save Macro - yet another question

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
  #2   Report Post  
Paul B
 
Posts: n/a
Default

Roger, use something like this

Application.DisplayAlerts = False
'Your Save Code
Application.DisplayAlerts = True


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Roger" wrote in message
...
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



  #3   Report Post  
Peter Rooney
 
Posts: n/a
Default

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

  #4   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

  #5   Report Post  
Roger
 
Posts: n/a
Default

thanks for that

"Paul B" wrote:

Roger, use something like this

Application.DisplayAlerts = False
'Your Save Code
Application.DisplayAlerts = True


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Roger" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop getting the file save box when running a macro Pank Mehta Excel Discussion (Misc queries) 1 March 29th 05 04:05 PM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM
Macro in Excel 2002 to save a workbook to a FTP location Lloyd Excel Discussion (Misc queries) 0 December 21st 04 02:49 PM
How do I create a macro to Save As? Shelly9633 Excel Discussion (Misc queries) 3 December 3rd 04 05:38 PM
This one is tricky....Macro to save file as cell value x in di Andy Excel Discussion (Misc queries) 4 November 26th 04 08:52 AM


All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"