Overwrite file with same name

Tigrou25

New Member
Joined
Nov 22, 2018
Messages
14
Hi there,

I try to overwrite a file when I save it.

I have put the following code but it doesn't work, it asks me if I want ro replace the file.

Code:
Application.DisplayAlerts = False
I have also tried
Code:
ActiveWorkbook.Application.DisplayAlerts = False

Here the full code
Code:
ActiveWorkbook.SaveAs Filename:= _        "S:\Construction\National - Head Office\A Profit and Loss\A01 FY Budgets\08. FY19 P&L\1.Monthly P&L Review\Excel\1. NAT CONST CMT P&L.xlsx" _
        , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
 ActiveWorkbook.Application.DisplayAlerts = False
        ActiveWindow.Close
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You need to set the DisplayAlerts property to False before saving your workbook...

Code:
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs ...
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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