![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 31
|
The following code works fine in my VB program however when the code is executed it always asks if you want to save over the previous version. Is their a way to default the save so the message will not come up asking if you want to overwrite.
'Save the Workbook and Quit Excel oBook.SaveAs "C:atemplot.xls" oExcel.Quit |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
Add this line at the beginning of your sub... On Error Resume Next Add this line before you save the new file... Kill "C:\atemplot.xls" This will delete the old file. The On Error will keep the macro from stopping as a run-time error will occur if you try to delete a file which does not exist. Tom |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Posts: 31
|
Awesome that will work, Thanks Tom
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Brampton
Posts: 324
|
Whenever you want to avoid the display of warning messages, and to execute the default alternatives use:
Application.DisplayAlerts = False In your case place this statement before the line with SaveAs, and after that place following line of code: Application.DisplayAlerts = True |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|