![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 83
|
I want to make a spreadsheet available for say 30 days, then, after that time a messagebox appears notifying the user that the spreadsheet has expired ( and subsequently prevents them from opening it ) but then I still want to open it .. so can the messagebox then prompt for the same VBA password that protects all the code .. and if it is entered correctly .. opens the password as normal ?
Thanks Bill |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
Code:
Private Sub Workbook_Open()
Dim StartDate As Date
StartDate = "04/16/2002"
If DateDiff("d", Now, StartDate) >= 30 Then PasswordCheck = InputBox("Password has expired, enter password")
If PasswordCheck <> "password" Then
Application.DisplayAlerts = False
ThisWorkbook.Close
End If
End Sub
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
dont rely on Excel protection is aweful and stop advance user for about 3 1/2 seconds be for we rip it apart, but will keep out the non advanced user or about 5 seconds.
just to say so not relying on this to much easy hacked...
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Jack is very right. To get around it all you have to do is disable macros.
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: CA
Posts: 180
|
I am confused. It seems the code above closes the workbook with no message appearing.
Am I doing something wrong? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|