Interrupt SaveAs on All new files using Personal.xlsb

Ivan Howard

Active Member
Joined
Nov 10, 2004
Messages
333
Hello all,

I have had a look on a few forums and can't find the answer to my question. Please can someone give me a hand?

I have Microsoft's Sensitivity Labelling software running and it requires that I select a label before I can use SaveAs for any new files. This poses as 'issue' in two scenarios:

1. When using VBA to create a new workbook as part of an automated process (e.g. exporting subsets, etc.), the process stops mid-point on each export so that the user can select a label. When running 30+ files, this was challenging but thankfully I have found a way to select a label mid-process using VBA so now, in this scenario, the code doesn't get interrupted and generates as many files as I want without pausing for user input. The link to this solution is here: Change Sensitivity Label Programatically

2. The second scenario is when I manually save a new workbook using SaveAs, I cannot get around the prompt to select a label. This is where I need a hand. I'd like to write some VBA that effectively applies a label (using my code from point 1 above) before the SaveAs process is run. As I do not want to have VBA in "ThisWorkbook" in every new file, I have tried using "Private Sub Workbook_BeforeSave..." in the PERSONAL.XLSB file, but, as I thought, it doesn't trigger when I save a new file, probably because it is trying to save the Personal.XLSB file and not the new file.

The question is, can I write some code that interrupts the SaveAs process on ALL new files - without having any VBA in those files?

Any help will be greatly appreciated.

Many thanks.
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,809
Messages
6,181,076
Members
453,020
Latest member
mattg2448

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