In order to do something like that you need to log the access attempts, either in a hidden text file or a hidden sheet/obscure cell. Then have your code refer to the count.
HTH,
Smitty
Private Sub Workbook_Open()
Dim StartTime#, CurrentTime#
Const TrialPeriod# = 1 '< 1 days trial
Const ObscurePath$ = "C:\"
Const ObscureFile$ = "LBFileLog.Log"
If Dir(ObscurePath & ObscureFile) = Empty Then
StartTime = Format(Now, "#0.#########0")
Open ObscurePath & ObscureFile For Output As #1
Print #1, StartTime
Else
Open ObscurePath & ObscureFile For Input As #1
Input #1, StartTime
CurrentTime = Format(Now, "#0.#########0")
If CurrentTime < StartTime + TrialPeriod Then
Close #1
Exit Sub
Else
Call MsgBox("This Workbook Has Expired. Please Enter Password To Continue", vbCritical, "EXPIRED!")
Dim userResponse As Variant, i As Byte, pw As String
pw = "password"
For i = 1 To 3
userResponse = InputBox("Enter password")
i = i + 0
If userResponse = pw Then Exit For
Next i
If userResponse <> pw Then
Call MsgBox("Wrong password, The Workbook Will Not be Deleted", vbCritical, "")
ThisWorkbook.Close SaveChanges:=False
Exit Sub
End If
End If
End If
End Sub
Actually my code has that, and I have the kill me code to input into the code, but not sure how to go about implementing a way to warn the user they only have "x" amount of time to enter the correct password before the workbook is deleted. Also, how do I go about giving the user unrestricted access to the workbook after purchasing the password and not be prompted for a password again.