melewie
Board Regular
- Joined
- Nov 21, 2008
- Messages
- 188
- Office Version
- 365
- Platform
- Windows
Hi All,
I am having some problems with application input box's, I'm trying to use them as a way to enter a password before the user is allowed access to a sheet, the code below is what I have, this works if the user enters the right password and if the user hits the cancel button.........however if the user enters the wrong password I get a Runtime 13 type mismatch on this line
which I don't understand . I must be missing something........(like a basic understanding of VBA!!)
Any help is hugely appreciated (I've got a right headache )
Cheers
Lewie
I am having some problems with application input box's, I'm trying to use them as a way to enter a password before the user is allowed access to a sheet, the code below is what I have, this works if the user enters the right password and if the user hits the cancel button.........however if the user enters the wrong password I get a Runtime 13 type mismatch on this line
Code:
If pword = False Then
Code:
Private Sub CommandButton1_Click()
Dim pword As String
pword = Application.InputBox("Enter password to view safety sheet", "PASSWORD REQUIRED")
If pword = "Safety" Then
Worksheets("safety").Visible = True
Worksheets("safety").Select
Worksheets("Navigator").Visible = xlVeryHidden
Else
If pword = False Then Exit Sub
MsgBox "Password incorrect please try again"
End If
End Sub
Any help is hugely appreciated (I've got a right headache )
Cheers
Lewie