Disable any save method

Derick63

Board Regular
Joined
Apr 6, 2018
Messages
76
Office Version
  1. 365
Hello all. I want to make a copy of my Excel application into a demo/evaluation version so I do not want the give the user an opportunity to save the workbook at all. I am currently using this code:

VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    MsgBox "This is an evaluation version. You can't Save, Save As... or Save a Copy As of this workbook!", 48, "Payroll Evaluation Version"
    Cancel = True

End Sub

It seems to be working but I don't know too much about Cancel = True and the effects it has on other modules. Is this a good way to disable all saving methods? I know if a user enters "Design Mode" the workbook can be saved but the chances of that happening are slim to none, but still, an ounce of prevention prevails here.
Since my app opens and functions totally in Full Screen Mode it does not utilise any menus or ribbons so I thought of disabling all ribbons and menus and replacing it with a custom ribbon menu with one macro, when clicked, opens a message box stating that editing is not allowed (not sure how to do that... yet). This would surely prevent "Design Mode" from being selected.

I am using MS Office 365 Excel on Windows 10. The app is designed to be backward compatible and does not utilize any functions or coding specific to Excel365
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
The "Cancel = True" part is what is telling it to cancel the save (it is an essential part of the code, telling it to cancel the save attempt).

This would work, as long as the have Macros/VBA enabled. If they disable it before opening the file, this code will never run.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,700
Members
452,938
Latest member
babeneker

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