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
 
yea, thats what ive ben doing, perhaps excel isnt really my thing, lol!
ill give it another go tho and ill let u know how im getting on :o)
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Are you getting any error messages ??
It works fine for me on Excel 2003 !!

Regards
Michael M
 
Upvote 0
no errors, i kinda slightly changed it when it wudnt work properly, so this is wot i got

Sub Workbook_Open()
Dim exdate As Date, ws As Worksheet, PW As String
exdate = "12/01/2008"
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
MsgBox ("Password is Correct, Please Proceed")
Exit Sub
End If
End If
For Each ws In Worksheets
Activepassword.close
Next ws
MsgBox ("The Password is incorrect, This file is now locked from any further use")
End Sub

so ive put in the activeworkbook and changed the date for tomorrow, so in theory the workbook should open normally, but for some reason it doesnt :(

oh, im using excel 2007
 
Upvote 0
These lines won't work, so take them out.
Code:
For Each ws In Worksheets
Activepassword.close
Next ws
You also state that you changed the date to tomorrow, but the code has "12/01/2008"
which is actually the 12th 0f January.
Try using "2/12/2008"

Regards
Michael M
 
Upvote 0
If you want the workbook to actually close down, use this.
Code:
Sub Workbook_Open()
Dim exdate As Date, ws As Worksheet, PW As String
exdate = "10/30/2008"
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
MsgBox ("Password is Correct, Please Proceed")
Exit Sub
End If
End If
MsgBox ("The Password is incorrect, This file is now locked from any further use")
ActiveWorkbook.Close
End Sub

Regards
Michael M
 
Upvote 0
its nearly working, i changed the date to 10/12/2008 so effectivly the message should only show up after the 12th of december 2008, is that correct???
because im getting the message "you have reached the end of your trial period" now even tho i dont want it to show until after the 12th dec.

any ideas?
 
Upvote 0
Ok, sorry, I didn't think that maybe your region is using the method you stated.
Try changing the date back to the way you had it.
Otherwise it should be fine.
Thanks also for the comment, but that's why the board exists....to help each other.

Regards
Michael M
 
Upvote 0
as soon as i change the date to the 1oth decemeber it goes directly to "The Password is incorrect, This file is now locked from any further use"
still no luck im affraid :(
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
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