Maybe time is running out in your code
So thanks for this question. Thank you for choosing generosity. This is a very interesting question, given your desire to monetize VBA code as a VBA programmer, I generally accept that I cannot monetize VBA code. It’s good that you insist, and I will try to answer.
First, let me join a chorus of answers that say VBA is easy to crack. Password protection may be compromised. I would join the chorus of respondents who say that you should choose a compiled language as a ship for your code. Why not try C # or VB.NET hosted in the Visual Studio Tools for Office (VSTO) .NET assembly?
VSTO will associate the compiled assembly with the book. This mechanism is worth knowing, because if you insist on VBA, we can use the same mechanism (see below). Each book has a CustomDocumentProperties collection in which you can set custom properties (this means that the document is not a table, since the same can be found in Word, so the document is generalized).
Excel will look at the CustomDocumentProperties collection of the workbook and look for "_AssemblyName" and "_AssemblyLocation"; if _AssemblyName is an asterisk, then he knows that he needs to load the .NET / VSTO assembly, _AssemblyLocation provides a search for the downloaded file (you will have to delve into it, I forgot the details). Link
Anyway, I was reminded of the VSTO CustomDocumentProperties mechanism, because if you insist on using VBA, I suggest storing the value in the CustomDocumentProperties collection, which will help you expire the functionality of your code. Note. Do not use BuiltInDocumentProperties ("Creation Date") as it is easily identifiable; use a codeword instead, such as "BlackHawk". Here is a sample code.
Sub WriteProperty() ThisWorkbook.BuiltinDocumentProperties("Creation Date") = CDate("13/10/2016 19:15:22") If IsEmpty(CustomDocumentPropertiesItemOERN(ThisWorkbook, "BlackHawk")) Then Call ThisWorkbook.CustomDocumentProperties.Add("BlackHawk", False, MsoDocProperties.msoPropertyTypeDate, Now()) End If End Sub Function CustomDocumentPropertiesItemOERN(ByVal wb As Excel.Workbook, ByVal vKey As Variant) On Error Resume Next CustomDocumentPropertiesItemOERN = wb.CustomDocumentProperties.Item(vKey) End Function Sub ReadProperty() Debug.Print "ThisWorkbook.BuiltinDocumentProperties(""Creation Date""):=" & ThisWorkbook.BuiltinDocumentProperties("Creation Date") Debug.Print "CustomDocumentPropertiesItemOERN(ThisWorkbook, ""BlackHawk""):=" & CustomDocumentPropertiesItemOERN(ThisWorkbook, "BlackHawk") End Sub
Thus, you can set the CustomDocumentProperty "BlackHawk" at the initial time the book was created, and then allow the client to use the code for 24 hours or even 48 hours (be careful with weekends, create Friday work until Tuesday), and then the code may refuse to work and instead, leave a message saying that paying LimaNightHawk more money!
PS Good luck with your income model.
PPS I read your profile, thanks for your military service.