Expiry date with password

cobwebs2222

New Member
Joined
Nov 24, 2008
Messages
16
hi people,

Ive been trying to do this for ages now, but decided i need further help!
Im fairly new to VB but getting the hang of it, however this one gets passed me.

I have made a spreadsheet that works out figures and conversion rates and stuff, however i would like it to expire with the option of a password lets say for example after 30 days, this will effectivly dissable, or close the spreadsheet down until a password is put in, then it will all come back to life.

ive been trying to think of a way round this now for days, but headache after headache i still cant get it to work. The formula doesnt have to be that secure, as the people using it im certain would never even look for it untill its too late!


I really hope some one out there can help me

and any suggestions would be most welcome.

Cheers x
 
Ah, of course I didn't give you the other option.
Code:
Sub Workbook_Open()
Dim exdate As Date, ws As Worksheet, PW As String
exdate = "02/12/2008"
If Date < expdate Then
Exit Sub
End If
If Date > exdate Then
MsgBox ("You have reached the end of your trial period")
PW = InputBox("Enter password:")
If PW = "Password" Then
For Each ws In Worksheets
    ws.Unprotect
  Next ws
Exit Sub
End If
MsgBox ("The Password is incorrect, This file will now be closed")
ActiveWorkbook.Close
End If
End Sub

I was also trying to work out why the expiry date of 31/11/2008, wouldn't work.
Duh......there is no 31/11/2008 !!

Regards
Michael M
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
:) FANTASTIC :)
OMG, youve made me a very happy person, lol
ive been working so hard on this thing and for so long, and that was the finishing touch to it all.

I honestly cant thank you enough for all your help.

I may have a few more things in the future if you dont mind, lol

Chers again x
 
Upvote 0
Yeah, it might have been about 5 posts quicker, If i'd have thought a bit more about the other option. Anyway,glad we got it worked out.
And thanks for the feedback.
Regards
Michael M
 
Upvote 0
just one maybe for the future if your not busy, but is it possible to delete the file (and out the recycle bin) after like 3 attemps? or am i asking too much? lol
 
Upvote 0
Firstly, deleting a file may result in your hard earned work disappearing forever.
Do you really want to do that ??
If you delete the file your code has also gone forever.
I'm sure if it keeps coming up locked the user will stop trying.
But yes, it can be done
Maybe something like, if it is more than 7 days past the exp date, delete the file.

Personally I wouldn't do it. I think it will cause more heartache than help.

Regards
Michael M
 
Upvote 0
yea, i see your point, the whole thing ive been working on is for work, its something ive been doing in my own time, now the boss wants to circulate it round the whole company, but lets say for example i get fired or decide to leave the company, i just didnt want them to have wot ive (and you, lol) have worked so hard on if you know wot i mean! so if its deleted off there system then they can never have it, or try and crack it after ive gone! lol
 
Upvote 0
I know how you feel but cracking Excel stuff takes a few seconds if you know how.
But I have gone through the same thing for some years. I see it as personal development in learning how to do these things in the first place.
As I said it can be done !!

At least you can have a think about it before you jump in.
Another thought. What happens if you forget when the exp date was....and try to open it one day.......gone.

Besides, it's really easy to bypass all the code anyway !!

Michael M
 
Upvote 0
Glad to help.
look on the positive side
I'm sure there's little chance of getting fired, if your boss wants to show off your handiwork to everybody in the company......!!

Michael M
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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