HI,
I have a VBA UserForm that is a Licence Key that shows if it is the first time it is used on a computer then shows another Userform to Login to the Spreadsheet but the issue that i have is if the licence key has previously been entered it will not show the second userform and i need the second userform to always show and the Licence Key Userform to only show if it has not previously been installed on the computer before. Any Help you can provide would be appreciated.
The UserForms that i have are
UserForm1
Login
The VBA Codes i have are
This Is for the Licence Key (UserForm1)
Then the Macro Code that i have that is used to open the Licence Key UserForm if needed.
Thanks
I have a VBA UserForm that is a Licence Key that shows if it is the first time it is used on a computer then shows another Userform to Login to the Spreadsheet but the issue that i have is if the licence key has previously been entered it will not show the second userform and i need the second userform to always show and the Licence Key Userform to only show if it has not previously been installed on the computer before. Any Help you can provide would be appreciated.
The UserForms that i have are
UserForm1
Login
The VBA Codes i have are
This Is for the Licence Key (UserForm1)
VBA Code:
Private Sub Label6_Click()
LKey = "987654321"
Sheet14.Range("A1") = Sheet14.Range("A1") + 1
If TextBox1 & TextBox2 & TextBox3 & TextBox4 & TextBox5 & TextBox6 & TextBox7 & TextBox8 & TextBox9 = LKey Then
MsgBox "SUCCESSFUL", vbInformation, ""
'Application.Visible = True
ThisWorkbook.Save
Unload Me
Login.Show
Else
If Sheet14.Range("A1") = 2 Then
MsgBox "INVALID KEY ENTERED TWICE - THIS FILE WILL NOW CLOSE", vbInformation, ""
Sheet14.Range("A2") = ""
If Application.Workbooks.Count > 1 Then
ThisWorkbook.Close
Else
ThisWorkbook.Save
Application.Quit
End If
Else
MsgBox "INVALID KEY", vbInformation, ""
Unload Me
UserForm1.Show
End If
End If
End Sub
Then the Macro Code that i have that is used to open the Licence Key UserForm if needed.
VBA Code:
Option Explicit
Sub Auto_Open()
'Application.Visible = True
With Sheet14
.Visible = xlSheetVeryHidden
If .Range("A2") = "" Then
.Range("A1") = ""
.Range("A2") = Environ$("ComputerName")
Application.Visible = False
UserForm1.Show
ElseIf .Range("A2") <> Environ$("Computername") Then
MsgBox "THIS FILE IS NOT LICENCED FOR THIS PC", vbInformation, ""
If Application.Workbooks.Count > 1 Then
Application.DisplayAlerts = False
ThisWorkbook.Close
Application.DisplayAlerts = True
Else
ThisWorkbook.Save
Application.Quit
End If
End If
End With
End Sub
Thanks