+ Reply to Thread
Results 1 to 10 of 10

Trail period and activation key in VBA

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    13

    Trail period and activation key in VBA

    Hi all,

    I'm selling an Excel template with a lot of macro's in it to self employed customers.

    The problem with Excel is that if you send the file to someone, they can use it forever, even if they didn't pay for it.
    Basically, I would like to have the option to send the file over to someone, then send the invoice and give 30 days to pay me.

    If he didn't pay before those 30 days, the workbook should state that the trail period is over and he should enter the activation key.
    This key (or password whatever) will be sent by me once the payment is received.

    I hope it's clear what I'm looking for?

    I found some code to make the trial period work, but I want to expand this code to disable the macro once the correct key was entered.
    Just thinking out loud now, but maybe some code that checks if in a certain cell in a hidden worksheet is equal to the activation key, then the workbook doesn't close.
    If it's not the same and the expiration date is passed, then close.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Trail period and activation key in VBA

    Are you aware how simple it is, even for non-programmers, to bypass any 'security features' built into a VBA application?

  3. #3
    Registered User
    Join Date
    04-05-2016
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    13

    Re: Trail period and activation key in VBA

    I sure am, but anything that makes it more difficult to use the file without paying helps...
    If they disable macro's, the file will be useless to them.

    But agreed, if they want to 'hack' it, they probably can.

    I know about the shift method for example, but I will add this code to every sheet in the file and run it when the sheet is opened.

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Trail period and activation key in VBA

    Anything can be broken into, no matter the language.

    My thoughts would be to to use VBComponents and upon 30 days reached deletes all modules in the workbook. That way they would have to contact you again for the working work book.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  5. #5
    Registered User
    Join Date
    04-05-2016
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    13

    Re: Trail period and activation key in VBA

    Thanks for your reply.

    The thing is that my workbook also acts as a database, so all the data that they generate using my file should not be deleted if they are a little bit late in paying...
    But I guess that's something to look into for maybe >90 days without payment or so.

    In the meantime I wrote some code that seems to do the trick:
    Please Login or Register  to view this content.
    So it checks the expiration date and if the password is written in a certain cell.
    If it's expired and the code is not there, then the user has to enter the key.
    If it's the same, the file is unlocked.
    I guess this will keep the majority of my clients with a locked file.

    Does anyone see any major flaws in this?
    Last edited by Exelance; 04-23-2016 at 11:11 AM.

  6. #6
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Trail period and activation key in VBA

    The basic problem, like I said, is any 'security features' in Excel can be bypassed - sometimes so easily it's laughable.

    Try and open the attached 'protected.xlsm' - Excel will complain that the workbook is corrupt. It is. I changed the first byte in the file from a Hex50 to Hex60 - so the file header is invalid for an Excel workbook, so Excel complains.

    The following code (which, for demo purposes, goes in another Excel workbook) will change the byte back to a H50, start another instance of Excel and load the patched file no problem.
    Please Login or Register  to view this content.
    Example only - it's doubly pointless to put code like that into an Excel workbook because of the 'security'. The reason for posting it is to illustrate a reasonably secure method to secure a workbook but that code really needs to be secure and the easiest way to do that is to get a copy of Visual Basic, either Classic VB6 or the newer VB NET. VB6 would be my choice (after using all versions of Visual Basic for nearly 20 years plus there's no external dependancies these days, you can just copy the EXE file without worrying about DLLs and the like). VBA is a subset of VB6 so there's a minimal learning curve (The code above can be ported to VB6 simply by changing 'ThisWorkbook' to 'App') and it can create EXE files which are more secure than any Excel method.

    There is other code needed - Trap when the file is being saved and change the File Header of those saved copies, or prevent saving if not being saved to the same directory as the Bootstrap program, and so on as far as you want to take it.

    It may seem like a lot of work but I cobbled this together in 5 minutes, it'd take about an hour to really tie this up tightly or at least tightly enough to prevent anyone but a reasonably skilled programmer to work around.
    Attached Files Attached Files
    Last edited by grimes0332; 04-24-2016 at 03:50 AM. Reason: Typo

  7. #7
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Trail period and activation key in VBA

    Quote Originally Posted by Exelance View Post
    Thanks for your reply.

    The thing is that my workbook also acts as a database, so all the data that they generate using my file should not be deleted if they are a little bit late in paying...
    But I guess that's something to look into for maybe >90 days without payment or so.

    In the meantime I wrote some code that seems to do the trick:
    Please Login or Register  to view this content.
    So it checks the expiration date and if the password is written in a certain cell.
    If it's expired and the code is not there, then the user has to enter the key.
    If it's the same, the file is unlocked.
    I guess this will keep the majority of my clients with a locked file.

    Does anyone see any major flaws in this?
    I don't mean deleting anything on the workbook, just make the code unusable, so they have to come to you for help,
    ie:
    Please Login or Register  to view this content.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Trail period and activation key in VBA

    One way is to use the following code for Workbook Open Event.
    The attached workbook contains a Sheet named Activation where A1 contains the Activation Key ("abab") for an example.
    If the user provides this Activation Key, user won't get any prompt for trial period.
    In the code the expiry date is set to "4/24/2016" so the user will have his/her last attempt to input an Activation Key on "4/24/2016" and after that date user won't be able to open the workbook.
    Please Login or Register  to view this content.
    See if this is something you can work with.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  9. #9
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Trail period and activation key in VBA

    Quote Originally Posted by sktneer View Post
    One way is to use the following code for Workbook Open Event.
    The attached workbook contains a Sheet named Activation where A1 contains the Activation Key ("abab") for an example.
    If the user provides this Activation Key, user won't get any prompt for trial period.
    In the code the expiry date is set to "4/24/2016" so the user will have his/her last attempt to input an Activation Key on "4/24/2016" and after that date user won't be able to open the workbook.

    See if this is something you can work with.
    Problem is , that VBA passwords are very easy to bypass.

  10. #10
    Registered User
    Join Date
    03-05-2021
    Location
    Brazil
    MS-Off Ver
    19
    Posts
    2

    Re: Trail period and activation key in VBA

    Take a look at a VB6 program that generates an activation key based on the hard drive code of the computer. It's activelock v3.5. I am using into excel VBA (Better, I think than the ones generated by excel)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add-in track trail changes with history
    By souza.eq in forum Excel General
    Replies: 4
    Last Post: 07-13-2015, 02:51 PM
  2. Audit Trail
    By jenziepie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2013, 01:56 PM
  3. Excel Audit Trail?
    By jvest0648 in forum Excel General
    Replies: 1
    Last Post: 12-17-2011, 02:57 PM
  4. Minimise/maximise Modeless Userform on activation/de-activation
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2009, 11:24 PM
  5. Track Changes - Audit Trail
    By ChemistB in forum Excel General
    Replies: 2
    Last Post: 10-27-2006, 02:16 PM
  6. [SOLVED] help!? trail report
    By Duncan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2006, 06:10 AM
  7. [SOLVED] Audit Trail
    By Pendelfin in forum Excel General
    Replies: 1
    Last Post: 01-23-2006, 11:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1