issue with multipage userform

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Hello all,
Is there a way I may restrict access to a page on a multi page userform?

Thanks
Kelly
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You could set the visible property of the page to True or False, eg

Code:
If Admin = True Then 
    Page2.Visible = True
Else
    Page2.Visible = False
End If
 
Last edited:
Upvote 0
.
Paste this into the UserForm level module :

Code:
Option Explicit


Private Sub CommandButton1_Click()


Dim x As String
Dim i As Integer
Me.MultiPage1.Pages(1).Visible = False
101:
     x = InputBox("Enter your Password.", "Password Required")
If x = "123" Then
    'Success!
    'Continue with your macro because the user typed the correct macro
    MsgBox "Welcome!"
    Me.MultiPage1.Pages(1).Visible = True
    Me.MultiPage1.Value = 1
Else
    If i <= 1 Then
        MsgBox "Invalid Password. Try again. You have " & (2 - i) & " tries left."
        i = i + 1
        GoTo 101:
    Else
        MsgBox "Incorrect password entered too many times. Try again later."
        Application.Visible = False
        Application.Quit
        
        Exit Sub
    End If
End If
End Sub


Private Sub UserForm_Initialize()
    Me.MultiPage1.Pages(1).Visible = False
End Sub


Download : https://www.amazon.com/clouddrive/share/FQG4fiajWt22SE5ar4Ox6jhmX4A2kdReTl2EqnG6s49
 
Upvote 0
You can also remove the tabs so that the user can only access the pages through controls you add. That will give you full control over who can see what.
 
Upvote 0
:eek:
Code:
        MsgBox "Incorrect password entered too many times. Try again later."
        Application.Visible = False
        Application.Quit

Very harsh, don't you think? :ROFLMAO:
 
Upvote 0
Oh okay thanks to all of you for your help.
I have not testers the codes yet but I am really impressed.

I am out of my pc now. I will test them and respond
 
Upvote 0
You can also remove the tabs so that the user can only access the pages through controls you add. That will give you full control over who can see what.

How do I remove the tabs?
Regards
Kelly
 
Upvote 0
Thats hard to do. Selecting just the Multipage and not just a page is hard to do I tried it. That's why I suggeted the script
Just change the Style property of the multipage at design time to fmTabStyleNone.
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,064
Members
448,545
Latest member
kj9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top