Private Sub Workbook_Open_()
Application.Visible = False
Load LoginForm 'It will be more correct
LoginForm.Show
'What's on the UserForm, what elements/fields ?
'What data is taken from it, only the expire date ?
Dim exdate As Date
exdate = Format("10/12/2018", "DD/MM/YYYY")
If Date > exdate Then
MsgBox "Sorry! Evaluation period of the utility has expired." & vbCrLf & _
"Please consult the Administrator.", vbCritical, "Outdated/Expired Version"
Dim mbox As String '? Where is 'mbox' declaration ?
'? Function or method ? i.e. 'InputBox' or 'Application.InputBox' ?
mbox = Application.InputBox("Pls enter the password/code to continue...", "Password")
' Maybe function ('InputBox') ?
mbox = InputBox("Pls enter the password/code to continue...", "Password", "xxxxxxxxx")
'In both of the above cases, the password you enter (at the time of writing) will be visible to everyone
End If
If mbox <> "ABC" Then
Application.Visible = False '? It is already, at the beginning
End If
'MsgBox ("You have " & exdate - Date & "Days left")
MsgBox ("You have " & CStr(exdate - Date) & " Days left") 'It will be more correct
Application.Visible = True
End If '??? Where is 'If ... Then' for this line ???
End Sub
And
Originally Posted by
Newmord
I am using a workbook with set expire date. which runs behind userform at initiation ...
Originally Posted by
Newmord
I am tying to to add expiration date and days left for expiration to the workbook with this code: ...
? Above you wrote "workbook with set expire date", so ... ?
Originally Posted by
Newmord
I have a workbook with userform which runs the workbook behind the userform when initializing ...
There is no such fact in the code ... (?)
Attach some fragmentary, partial xls example, it will help get to know this topic better.
Bookmarks