+ Reply to Thread
Results 1 to 10 of 10

Hide portion of a UserForm

  1. #1
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Hide portion of a UserForm

    Hi there,

    I hope you are all well.

    I have a userform that I wish to load with part of it hidden, the other part have only a TextBox where a password is required.

    After typing the correct password (case sensitive) and when a command button is clicked I would like the hidden part of the form to become visible.

    On the other hand, after the 2nd wrong password, I want the UserForm to close.

    I want to have information on that UserForm that only a couple of people could have access to as the file will be stored on a SharedDrive and will be used for all employees.

    I know it’s possible to do that but I don’t know how. Any Ideas?

    Many thanks in advance and kind regards,
    Filipe

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Hide portion of a UserForm

    Filipe

    Change the size of the userform in the intialize event so only the controls you want the user to see are visible.

    Then when they enter the correct password increase the size so all the controls can be seen.
    Last edited by Norie; 03-06-2013 at 11:59 AM.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Hide portion of a UserForm

    Heres an example. I would create a password form (could use Inputbox instead). Click the button on the sheet it will show the password form. Password is set to Password. If password is entered 2 times incorrect then your main form will not be shown.
    Attached Files Attached Files
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Hide portion of a UserForm

    Or heres one with inputbox

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Hide portion of a UserForm

    Hi Mike,

    This is better than I thought. Just brilliant.

    I am in process to develop an excel tool.

    Sorry abvout this but I am starting with VBA.

    Let's suppose that there's 3 users (employees) with their own password. If the "user1" types his/her password, a UserForm1 is shown.

    If the "user2" types his/her password, a UserForm2 is shown and the same for "User3".

    Should I create an independent code for each user?

    Thanks a million for your time and patience.

    Best regards,
    Filipe

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Hide portion of a UserForm

    See attached wb. Pass1 will open form1, Pass2 or Pass3 will open form2, Pass3 or Pass4 or Pass5 will open form3.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Hide portion of a UserForm

    Hey Mike,

    As Americans say: "You Hit a Home Run" with that one.

    Don't know how to thank you for your time on this one.

    Thanks a million for it, I am very appreciated with all your help.

    Best regards,
    Filipe

  8. #8
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Hide portion of a UserForm

    Your Welcome. Thanks for the Rep

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Just curious, will each userform be completely different for each user?

    Also, how many users will there be?

  10. #10
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Hide portion of a UserForm

    Hi Norie,

    Well, the tool is still on the blueprint phase but I am thinking on having at least 6 different UserForms.

    The users will be around 30 and the access to those UserForms will be depending on the users roles/functions. The passwords will be distributed accordingly.

    As well just curious, do you have something on your mind?

    Best regards,
    Filipe

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1