issue with multipage userform
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: issue with multipage userform

  1. #1
    Board Regular kelly mort's Avatar
    Join Date
    Apr 2017
    Location
    Suhum, Ghana, West Africa
    Posts
    919
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default issue with multipage userform

    Hello all,
    Is there a way I may restrict access to a page on a multi page userform?

    Thanks
    Kelly

  2. #2
    Board Regular Paul Ked's Avatar
    Join Date
    Jun 2015
    Location
    LLangollen, Wales
    Posts
    130
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: issue with multipage userform

    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 by Paul Ked; Nov 30th, 2017 at 09:43 PM.

  3. #3
    Board Regular Logit's Avatar
    Join Date
    Aug 2016
    Location
    United States
    Posts
    1,235
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default Re: issue with multipage userform

    .
    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/sh...dReTl2EqnG6s49

  4. #4
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    31,267
    Post Thanks / Like
    Mentioned
    13 Post(s)
    Tagged
    1 Thread(s)

    Default Re: issue with multipage userform

    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.

  5. #5
    Board Regular Paul Ked's Avatar
    Join Date
    Jun 2015
    Location
    LLangollen, Wales
    Posts
    130
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: issue with multipage userform


    Code:
            MsgBox "Incorrect password entered too many times. Try again later."
            Application.Visible = False
            Application.Quit
    Very harsh, don't you think?

  6. #6
    Board Regular kelly mort's Avatar
    Join Date
    Apr 2017
    Location
    Suhum, Ghana, West Africa
    Posts
    919
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: issue with multipage userform

    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

  7. #7
    Board Regular kelly mort's Avatar
    Join Date
    Apr 2017
    Location
    Suhum, Ghana, West Africa
    Posts
    919
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: issue with multipage userform

    Quote Originally Posted by RoryA View Post
    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

  8. #8
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    11,783
    Post Thanks / Like
    Mentioned
    8 Post(s)
    Tagged
    3 Thread(s)

    Default Re: issue with multipage userform

    Put this script in your Userform:

    Modify if needed:

    Code:
    Private Sub UserForm_Initialize()
    MultiPage1.Style = fmTabStyleNone
    End Sub


    Quote Originally Posted by kelly mort View Post
    How do I remove the tabs?
    Regards
    Kelly
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

  9. #9
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    31,267
    Post Thanks / Like
    Mentioned
    13 Post(s)
    Tagged
    1 Thread(s)

    Default Re: issue with multipage userform

    Quote Originally Posted by kelly mort View Post
    How do I remove the tabs?
    Regards
    Kelly
    Just change the Style property of the multipage at design time to fmTabStyleNone.

  10. #10
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    11,783
    Post Thanks / Like
    Mentioned
    8 Post(s)
    Tagged
    3 Thread(s)

    Default Re: issue with multipage userform

    ††
    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
    Quote Originally Posted by RoryA View Post
    Just change the Style property of the multipage at design time to fmTabStyleNone.
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

DMCA.com