+ Reply to Thread
Results 1 to 9 of 9

Userform Log-in; Excel Hide and Unhide?

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    61

    Question Userform Log-in; Excel Hide and Unhide?

    Hi Guys,

    I am planning a little tool using userform in VB excel. What I really want to do is:
    When I double-click the excel icon (means the Macro-enable Excel File; not the actual excel application) in my desktop I want UserForm named “Log-in” to initialize and excel workbook should be Visible = False.

    Next when the user is Loged-in by appropriate ID and password the userform should disappear and excel workshhet named “Interface” should show-up - WBVisible = True

    How can I achieve this? I know how to do the log-in userform but looking some help in hiding and reappearing excel workbook.

    Basically, at the beginning I do not want excel to show up, only the userform “log-in” should be visible and once log-in excel should be visible and user-form should disappear. Thanks a lot.
    Last edited by artistdedigital; 09-23-2015 at 12:48 AM.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Userform Log-in; Excel Hide and Unhide?

    i guess

    Please Login or Register  to view this content.
    then in the userform
    with all the password etc code
    if ok
    application.visible = true

    if it fails
    Application.Quit
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    09-08-2014
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    61

    Re: Userform Log-in; Excel Hide and Unhide?

    Hi humdingaling,

    Thanks for the reply. I have done a little experiment with the code you provided. However it seems there is something still missing. Please have a look at the example file if possible and guide me please? At this moment it still require to open excel and run the userform from the VB window, then it hides the excel and on click button it should show excel back and hide the userform? can you check it please? Thanks again.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Userform Log-in; Excel Hide and Unhide?

    it needs to be in thisworkbook module
    Attached Files Attached Files

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform Log-in; Excel Hide and Unhide?

    What do you want to happen when the user clicks "Disable Macros" at the start up?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Registered User
    Join Date
    09-08-2014
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    61

    Re: Userform Log-in; Excel Hide and Unhide?

    Hi humdingaling,
    Thanks heaps. It was a silly mistake. Really appreciate your help. Cheers man.

  7. #7
    Registered User
    Join Date
    09-08-2014
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    61

    Re: Userform Log-in; Excel Hide and Unhide?

    Quote Originally Posted by mikerickson View Post
    What do you want to happen when the user clicks "Disable Macros" at the start up?
    Hi mikerickson,
    What do you mean? I never thought of that! What do you suggest? I guess I want to enforce enable macro somehow! Any ideas? Thanks.

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform Log-in; Excel Hide and Unhide?

    One cannot disable the Enable Macros? dialog.

    There are various workarounds (like very hiding sheets on Close) that make it harder for a user to bypass the password set-up, but the solution that I use is to forget the idea of "security" or "control" via VBA coding.
    Design a workbook where the user will want to enable the macros and go through the password screen. Make it easier for them to do what they want to with your VBA. Fighting with users ("User wants to do X. I want Y, not X") doesn't end well. If the user wants X in order to do their job, give them X. Give them Y as well.

    The coder is the user's servant, not their master.

  9. #9
    Registered User
    Join Date
    09-08-2014
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    61
    Quote Originally Posted by mikerickson View Post
    One cannot disable the Enable Macros? dialog.

    There are various workarounds (like very hiding sheets on Close) that make it harder for a user to bypass the password set-up, but the solution that I use is to forget the idea of "security" or "control" via VBA coding.
    Design a workbook where the user will want to enable the macros and go through the password screen. Make it easier for them to do what they want to with your VBA. Fighting with users ("User wants to do X. I want Y, not X") doesn't end well. If the user wants X in order to do their job, give them X. Give them Y as well.

    The coder is the user's servant, not their master.
    Excellent thought man. Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 02-26-2016, 03:58 AM
  2. Userform/checkbox hide/unhide rows based on cell value
    By MOHAMMESALMAN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2015, 03:17 AM
  3. [SOLVED] VBA Userform with ComboBox to Hide/Unhide Rows
    By leecook in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-01-2013, 03:50 AM
  4. Simple UserForm/Worksheet Hide/Unhide
    By Chris1201 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2010, 02:00 PM
  5. should I use hide/unhide with userform?
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2009, 08:13 PM
  6. UserForm to Hide/Unhide Rows
    By John Michl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2006, 05:55 PM
  7. Excel 97 hide unhide problem
    By Catt in forum Excel General
    Replies: 2
    Last Post: 06-01-2006, 11:45 AM

Tags for this Thread

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