Link to home
Start Free TrialLog in
Avatar of chris_thorn
chris_thorn

asked on

Password protecting part of tabstrip

I have a userform using a tabstrip control.  On of the tabs is a management tab and should only be accessed by certain people...preferrably password protected.  Users do not have to login to the sheet otherwise and that's not an option.  What I'd like to do is when a user attempts to access that tab, a prompt pops up asking for a password.  If correct, the tab is show but if not, the user gets an error.

Any help is appreciated,
Chris
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Chris,
You can use something like this, but again this will ask for the password when user selects that tab and its shown, however if the password dont match it selects sheet2 and this code goes in the sheet module of that sheet for which you want to ask for password, The password i saved in this case was abc.
Saurabh...

Private Sub Worksheet_Activate()
    Application.ScreenUpdating = False

    Dim pswrd As String

    pswrd = Application.InputBox("Please enter password to view the sheet", "Enter Password", Type:=2)

    If pswrd <> "abc" Then

        MsgBox "Incorrect Password Entered"
        Sheets("sheet2").Select
    End If

    Application.ScreenUpdating = True
End Sub

Open in new window

Avatar of chris_thorn
chris_thorn

ASKER

Thanks for the feedback...the answer you posted seems like you are attempting to protect an individual sheet.  I'm trying to protect a tab on a tabstrip placed on a user form.

Any thoughts?

Chris
Ahh i see what you mean, Can you post your sample workbook so that i can have a look.
ASKER CERTIFIED SOLUTION
Avatar of Dana Seaman
Dana Seaman
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial