I have a user login form and I want the password to expire after a certain date. The workbook opens with a single page and the other sheets are made visible after successful login.
My sample user form login code is:
Private Sub cmdLogin_Click()
Dim user As String
Dim password As String
user = Me.txtUserID.Value
password = Me.txtPassword.Value
If (user = "admin" And password = "admin") Or (user = "user" And password = "user") Then
Unload Me
' Unhide all worksheets in the workbook
Worksheets("TS").Visible = xlSheetVisible
Worksheets("Hemp").Visible = xlSheetVisible
Worksheets("Maize").Visible = xlSheetVisible
Worksheets("Summary Page").Visible = xlSheetVisible
Worksheets("Water Calculations").Visible = xlSheetVisible
' Unhide a specific shape by name
Dim ws As Worksheet
Set ws = ActiveSheet ' Change to the desired worksheet
ws.Shapes("buttonLink").Visible = False
ws.Shapes("Pentagon 4").Visible = True
On Error GoTo 0 ' Reset error handling
Else
MsgBox "Invalid login credentials. Please try again."
End If
End Sub
Anyone help?
My sample user form login code is:
Private Sub cmdLogin_Click()
Dim user As String
Dim password As String
user = Me.txtUserID.Value
password = Me.txtPassword.Value
If (user = "admin" And password = "admin") Or (user = "user" And password = "user") Then
Unload Me
' Unhide all worksheets in the workbook
Worksheets("TS").Visible = xlSheetVisible
Worksheets("Hemp").Visible = xlSheetVisible
Worksheets("Maize").Visible = xlSheetVisible
Worksheets("Summary Page").Visible = xlSheetVisible
Worksheets("Water Calculations").Visible = xlSheetVisible
' Unhide a specific shape by name
Dim ws As Worksheet
Set ws = ActiveSheet ' Change to the desired worksheet
ws.Shapes("buttonLink").Visible = False
ws.Shapes("Pentagon 4").Visible = True
On Error GoTo 0 ' Reset error handling
Else
MsgBox "Invalid login credentials. Please try again."
End If
End Sub
Anyone help?