K0st4din
Active Member
- Joined
- Feb 8, 2012
- Messages
- 488
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello, everyone,
thanks to Logit from the forum we were able to reach the final of my request for help.
This is the link to my inquiry:
Setting a Trial Period in Excel
However, at one point I realized that we had not done it right. The password I can write (when the time comes, you can see it).
I searched a lot, but almost everyone says that in order not to be seen, it must be made in USERFORM1.
I ask for your help, how to unite the macro working perfectly, but to go through USERFORM to hide the password ******* with asterisks.
Thank you in advance for your help.
This macro works just perfect for my needs
Code for USERFORM1
thanks to Logit from the forum we were able to reach the final of my request for help.
This is the link to my inquiry:
Setting a Trial Period in Excel
However, at one point I realized that we had not done it right. The password I can write (when the time comes, you can see it).
I searched a lot, but almost everyone says that in order not to be seen, it must be made in USERFORM1.
I ask for your help, how to unite the macro working perfectly, but to go through USERFORM to hide the password ******* with asterisks.
Thank you in advance for your help.
This macro works just perfect for my needs
VBA Code:
Sub pass()
Dim mbox As String
Dim MyDate As Variant
Dim Passwd As String
MyDate = #8/30/2020# ' Assign a date. tuk se zapisva krainata data, dokoga da byde otvoren.
Passwd = "123456" 'Assign password
Application.ScreenUpdating = False
Sheets("Sheet1").Visible = True
'Sheets("Sheet2").Visible = xlVeryHidden
Application.ScreenUpdating = True
If Date > MyDate Then
MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
"Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
mbox = Application.InputBox("Pls input the password/code to continue...", "Password")
If mbox <> Passwd Then
MsgBox "Incorrect Password" & vbCrLf & _
"Pls ask the concern person to get the correct password.", vbCritical, "Wrong password"
Application.Quit
With ThisWorkbook
.Save
.ChangeFileAccess Mode:=xlReadOnly
'Kill .FullName
.Close SaveChanges:=False
End With
Else
'Sheets("Sheet2").Visible = True
Sheets("Sheet1").Visible = False
End If
End If
End Sub
Code for USERFORM1
VBA Code:
Private Sub CheckBox1_Click()
If UserForm1.CheckBox1.Value = True Then
UserForm1.TextBox1.PasswordChar = ""
Else
UserForm1.TextBox1.PasswordChar = "*"
End If
End Sub
Private Sub CommandButton1_Click()
If UserForm1.CheckBox1.Value = "123" Then
Unload Me
MsgBox ("Welcome!")
Else
Unload Me
MsgBox ("Invalid password, try again!")
UserForm1.Show
End If
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub