Closing the SaveAs message box automatically

DebugGalpin

Board Regular
Joined
Jun 29, 2011
Messages
175
Good morning,

I have a macro below that I have set up for when my spreadsheet opens. It's basic steps are:-

1) Checks to see if the daily backup has been saved down.
2) If it has it does nothing
3) If it hasn't it saves a copy down in the backup location (in range M2) and then saves it down again as it's original file name which is stored in range M3.

It obviously asks me if I want it to overwrite which I do. How can I close this box automatically, everything I've tried has failed so far,

Cheers
Debug

Private Sub Workbook_Open()
Sheets("Input Sheet").Select
Calculate
'Checks to see if the file has been backed up
Application.Run ("Backup")
'If the file has been backed up it does nothing
If Sheets("Input Sheet").Range("N2") = True Then
End

Else
'If file doesn't exist it saves it down
ActiveWorkbook.SaveAs Filename:=Range("M2").Value
ActiveWorkbook.SaveAs Filename:=Range("M3").Value


End If

End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try

Code:
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("M2").Value
ActiveWorkbook.SaveAs Filename:=Range("M3").Value
Application.DisplayAlerts = True
 
Upvote 0
Add code in red like this:

Code:
[COLOR=red]Application.DisplayAlerts = False[/COLOR]
ActiveWorkbook.SaveAs Filename:=Range("M2").Value
ActiveWorkbook.SaveAs Filename:=Range("M3").Value
[COLOR=red]Application.DisplayAlerts = True[/COLOR]

edit: need to learn to type faster... VoG beat me again ;-)
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,158
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top