Prevent Workbook Saving From An Add-In

RJPotts

Board Regular
Joined
Apr 11, 2007
Messages
143
Hi,

I've recently created (with help found here!) an add-in which provides the user with an additional toolbar button to run a document version check.

Applicable documents have their title / version number stored as custom document properties. Running the add-in compares the document name & version number with those in a central log (held in a mutually accessible network location) and advises the user if either the workbook version matches the latest version of that file recorded in the log, or if the workbook has been superceded and a newer version is available, or if the workbook version number exceeds the latest version of that file recorded in the log & that the log should be updated.

That's all working fine. However, I'd like do a little more with it. In the case of workbooks which have been superceded I would like to prevent the file from being either printed or saved.

I've found code which can do all that. However, it all resides in the workbook_beforeclose and workbook_beforeprint events.

Is there a way of an add-in preventing the saving or printing of a workbook? I.e. without the code being held in the subject workbook.

Best regards and in advance, many thanks!

Richard
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,

I'm still struggling with this.....

The document version check stuff all works well. I still cant find a way of preventing the activeworkbook being saved / printed with code which is held in an add-in though :( Does anyone know if it's even possible to do so please?

Best regards and in advance, many thanks!
Richard
 
Upvote 0
Is there anyone out there who might be able to help out on this one please?

Best regards
Richard
 
Upvote 0
Sorry to bump this again but I'm still struggling with it.

Is anyone able to assist / point me in the right direction please?

Best regards and many thanks in advance
Richard
 
Upvote 0
Have you considered hooking the application events from within the addin ? That way you could monitor the opening,closing,saving and printing of all the workbooks from the addin
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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