Excel VBA: how to get a file expired after 30 days unless a password is entered

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ronakinuk
    New Member
    • Jan 2009
    • 15

    Excel VBA: how to get a file expired after 30 days unless a password is entered

    Hi Thanks for reading and helping me out in this in advance.

    I have designed a training tool that mimics(dummy copy of) very secure financial system. Using this tool we train the new staff so that our main system stay secure and we feel safe giving details to new joiners.

    Its in excel VBA.

    I have following code in workbook_open event

    sub workbook_open()
    application.win dowstate = xlminimize
    userform1.show.
    end sub

    once userform1 comes up, depending on users responses further next userforms load and unload eventually, and we can deliver the whole lot of training giving a feel of real systems to delegates.

    However I want to do the following.

    I send this training tool to new joiners as an email attachment, so each one of them have a copy of this 2MB .xls file.
    they use it during 4 weeks training.

    But i dont have any ways to stop them from : using it or having a look at it or potentially taking my screenshots prints home or plot a fraud after the training is finished

    I want that my first userform will stop loading up after exactly 30 days for that particular user but it will come up if an administrator password will be entered.

    I am using the following code for that....
    this is a macro in module 1

    Sub expire()
    Static DateOpened As Date
    Static Check As Boolean
    If Check = False Then
    Check = True
    DateOpened = now
    'DateOpened = 37677
    End If
    If Now - DateOpened > 30 Then
    MsgBox "This workbook has expired", vbCritical + vbOKOnly, "Expired"
    Application.Qui t
    Else
    userform1.Show
    End If
    End Sub

    and then in above code for workbook_open event

    sub workbook_open()
    application.win dowstate = xlminimize
    if inputbox("pleas e enter access password") = "rinuk" then
    module1.expire
    else MsgBox "This workbook has expired", vbCritical + vbOKOnly, "Expired"
    Application.Qui t
    endif
    end sub


    which works fine, but its applicable to all users and even to copies of that file.

    I want it to expire after 30 days for that particular user, unless he knows admin password (rinuk)
    However if that user sends the file to someone else, it should let new user to use it for more 30 days..

    those who (about 20 people) will know the admin password (rinuk) will be able to use it forever.

    hope i have explained properly. please reply if you need more information.

    Your help is greatly appreciated.

    thanks
  • ronakinuk
    New Member
    • Jan 2009
    • 15

    #2
    resolved,
    thanks


    -rinuk

    Comment

    Working...