Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Skipping the "Overwrite" warning within a Macro

I am trying to write a macro that opens a file, saves it under a separate
file name, then opens a different file and saves that, etc. I would like to
avoid Excel asking me if I want to overwrite the file within the macro. Is
there a way I can either turn off warnings, or more preferably indicate to
overwrite the file when in the code itself to avoid clicking "Yes" ten times.

This is what the editor has as the recorded code.
ChDir "S:\Test\Macros"
Workbooks.Open Filename:="S:\Test\Macros\MacroA.xls"
ChDir "S:\Test\Copies"
ActiveWorkbook.SaveAs Filename:="S:\Test\Copies\FileA.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close

--
Sincerely,
Beverly76
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Skipping the "Overwrite" warning within a Macro

Use.
Application.DisplayAlerts = False
Make sure to turn the alerts back on at the end of your code by setting the
above to true.




Beverly76 wrote:
I am trying to write a macro that opens a file, saves it under a separate
file name, then opens a different file and saves that, etc. I would like to
avoid Excel asking me if I want to overwrite the file within the macro. Is
there a way I can either turn off warnings, or more preferably indicate to
overwrite the file when in the code itself to avoid clicking "Yes" ten times.

This is what the editor has as the recorded code.
ChDir "S:\Test\Macros"
Workbooks.Open Filename:="S:\Test\Macros\MacroA.xls"
ChDir "S:\Test\Copies"
ActiveWorkbook.SaveAs Filename:="S:\Test\Copies\FileA.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200809/1

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 do I suppress the "Do you want to overwrite the destination cells" message Rojo Habe Setting up and Configuration of Excel 1 July 30th 09 02:24 PM
How do you turn off "Save a copy/Overwrite changes" dialog box Nicko Excel Discussion (Misc queries) 4 December 8th 05 05:22 PM
selection.find shortening the procedure by skipping the "activate" part Peter[_21_] Excel Programming 1 November 10th 04 11:56 PM
Find a workbook and "overwrite it with the latest Excel format" PSKelligan Excel Programming 2 October 26th 04 01:45 PM
within a macro how can I suppress the warning pop "A file named xxxx.xls already exists in this location. Do you want to replace it?" Pete McCosh Excel Programming 0 April 2nd 04 04:51 PM


All times are GMT +1. The time now is 08:25 PM.

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

About Us

"It's about Microsoft Excel"