Restricting Excel File "Save As" Feature

Copper Contributor

Is there a way to limit the number of times an Excel file can be "Saved As"? With VBA?

I don't want to keep the Saved As feature from working at all, just limit it to work twice for any particular user. No more endless copies!

4 Replies
Hello @Whys1

There is a Workbook_BeforeSave event that you can use.

The first time you Save As you decrement a value by 1 until it gets to zero, and after that it will stop saving unless you do something special.

I am not sure if you really want to do something like that, saving a file is kinda important.

Maybe a better solution, albeit a bit more complicated is to use the Workbook_BeforeSave to judge how many minutes/hours has it been since the last save as and judge if you want to save as with a new name or not.

And as I was writing this I though of a simpler solution that would use the Workbook_BeforeSave to add a timestamp to the file name and then just go and delete the files that are too close.

So, the moral of the story here is that if you would tell us why is this needed, maybe we can get you a spot on solution.
Georgie Anne

Hi @GeorgieAnne

 

Thanks for your response. I sell an Excel based planning tool for individuals, but lots of professional firms have been buying it and making endless free copies for clients. Not fair to paying customers. Individuals sometimes make a couple of copies to try out different scenarios, but don't need to "save as" more than twice. I want to limit the number of times the file can be "saved as" (not "saved") to prevent firms from taking advantage. It's okay for the file to be "saved" as many times as needed, just not using "saved as".

This would not be a perfect fix but should act as a deterrent.

OK @Whys1
Thanks for the explanation, now am I entitled for a free copy just to see your handy work? ;)
Then I would suggest looking into making your workbook an Add-In look here:
https://support.microsoft.com/en-us/office/save-a-workbook-in-another-file-format-6a16c862-4a36-48f9...
https://www.contextures.com/exceladdins.html.

Also the you can use the aforementioned event to pop up a message stating your wishes for them not to use the workbook in a way that would infringe on you, possibly send an email to you every time the client does make a new copy. That might be a bit intrusive so seek legal advice. Also you can make the event save a copy and delete all others. I mean there are many ways to do what you want, just how strict you want to be is the ultimate question.
If you can solve this problem, you are welcome to a copy!
Stating wishes does not work as I have been told that "if I buy it I can do what I want!"
Saving in another format will disable macros in the file, preventing further entries/changes.
I can make a macro button that will save/export as pdf (or other file type) but then the file cannot be changed, defeating the purpose of having a working copy. Your original suggestion, I believe, limits the times the file can be saved, but not "saved as". I fear that I am asking to do something that is not capable of being implemented. Appreciate your replies!