Allkman
10-28-2016, 04:05 AM
Hello,
I have created "welcome" sheet in excel where i introduce my program and i also want to set TRIAL period for limited time of use.
I Placed code in ThisWorkbook.
Code wont run if i place it in "Welcome" sheet.
User can simply press "X" on MsgBOX or press "ESCAPE" and use program like nothing happened...
Weird thing is that it will start counting negative days like ( You have -1; -2; -3; ect.. Days left)
Option Explicit
Sub Workbook_Open()
Dim Edate As Date
Edate = Format("27/10/2016", "DD/MM/YYYY") 'replaced yesterdays date
If Date > Edate Then
MsgBox ("This worksheet was valid upto " & Format(Edate, "dd-mmm-yyyy") & " and will be closed")
ActiveWorkbook.Close
End If
If Edate - Date < 3 Then
MsgBox ("This worksheet expires on " & Format(Edate, "dd-mmm-yyyy") & " You have " & Edate - Date & " Days left ")
End If
End Sub
I tried: Application.EnableCancelKey nothing changes with this function..
Any suggestions?
Even if i manage to disable escape, user still has option to press "X" on MsgBOX.
For advanced users: Timebombing fails to save log file in C:\.... (in windows 10, but it saves log file in other partition disk`s like D:\ E:\ ect...) dont know about Win7....
Thank you in advance! :)
I have created "welcome" sheet in excel where i introduce my program and i also want to set TRIAL period for limited time of use.
I Placed code in ThisWorkbook.
Code wont run if i place it in "Welcome" sheet.
User can simply press "X" on MsgBOX or press "ESCAPE" and use program like nothing happened...
Weird thing is that it will start counting negative days like ( You have -1; -2; -3; ect.. Days left)
Option Explicit
Sub Workbook_Open()
Dim Edate As Date
Edate = Format("27/10/2016", "DD/MM/YYYY") 'replaced yesterdays date
If Date > Edate Then
MsgBox ("This worksheet was valid upto " & Format(Edate, "dd-mmm-yyyy") & " and will be closed")
ActiveWorkbook.Close
End If
If Edate - Date < 3 Then
MsgBox ("This worksheet expires on " & Format(Edate, "dd-mmm-yyyy") & " You have " & Edate - Date & " Days left ")
End If
End Sub
I tried: Application.EnableCancelKey nothing changes with this function..
Any suggestions?
Even if i manage to disable escape, user still has option to press "X" on MsgBOX.
For advanced users: Timebombing fails to save log file in C:\.... (in windows 10, but it saves log file in other partition disk`s like D:\ E:\ ect...) dont know about Win7....
Thank you in advance! :)