Prevent Sharing & Issue With Expiration VBA

mrfahaji

New Member
Joined
Oct 25, 2012
Messages
34
I have created an excel-based game that I plan to distribute. However, I don’t want people to be able to then share it freely with others, so I am looking for ways to protect the document. A password could work but I figure that people could just share the password along with the file, so I started looking at an expiry date.

Within the ThisWorkbook module, I have added the following

Dim exp_date As Date
exp_date = "16/07/2023" 'update this'
If Date > exp_date Then
MsgBox ("Worksheet expired. Please contact creator to renew access")
ActiveWorkbook.Close


But even though it works to an extent, I’ve noticed that you can close the message box and then when you get the save prompt on closing, simply click ‘Cancel’ and you can carry on accessing the workbook as usual. How can I prevent this?

I have considered adding a ‘clear’ command within the expiry macro, but I worry that such a command would ruin the document for anyone who goes back to play after some time away. Perhaps there is an option to get a reactivation code that would postpone the expiry date.

Is there any way to prevent this? Or any other suggestions for how to effectively protect the file against mass sharing/distribution would be very welcome! I know that the VBA approach can be circumvented quite easily, but it would be better than nothing. In some similar threads, and it looks like the XLS Padlock software might be my best solution, but it is pretty expensive!
 
You have the option to make the same file get the code from the pc and store it on the first workbook open.. if the file is opened on another pc and the code doesnt match you can set the file to close or delete, etc.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Sorry for the lack of reply from me. I appreciate elynoy's efforts in offering a solution and I understand the principle of having the two files - it's a smart idea but also a bit clunky for a situation where I might be sending it out to a few people at once.

I was thinking I could encrypt the files, with each file I send out having a different password - this wouldn't prevent sharing but done in such a way it could reduce it.

The main question I have, referring back to my original post, is how to make the expiration code a little harder to bypass. I accept that someone with good excel skills could figure a way to 'break' the code, but I was able to get around it simply by clicking 'cancel' on the save box after I got the message, which renders the code pretty much useless!
You could add the following to disable the cancel button:

application.enablecancelkey = xldisabled
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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