how to save on exit. (ONLY IF) workbook name is "XX"

aedctalk

Board Regular
Joined
Oct 9, 2010
Messages
156
Question. How could I make it so it only does the activeworkbook.saveas IF the workbook name currently open is called "BOWSER"

(i ask because once a week when program is closed the file renames itself to the date so then we we open old dated files it tries to overwrite bowser)

So just trying to avoid that and only run the below script if i'm currently running "BOWSER"

Thanks for any insight :)

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

    ActiveWorkbook.SaveAs "\\" & Sheets("Configuration").Range("J8").Value & "mbo" & Sheets("Configuration").Range("C21").Value & "\c\Documents and Settings\Manager\Desktop\" & Sheets("Configuration").Range("J21").Value & "\BOWSER.xls"

End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,224,609
Messages
6,179,874
Members
452,949
Latest member
Dupuhini

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