Closed Thread
Results 1 to 21 of 21

Userform in Excel with Remember Password and User id option or check button

  1. #1
    abhay_547
    Guest

    Userform in Excel with Remember Password and User id option or check button

    Hi All,

    I have userform in excel which asks user to enter user id and password. I want a to have "Remember Me" check button on my userform which will remember user details and he wouldn't have to enter user id and password again and again. Can please provide me with an example code.

    Thanks a lot for your help in advance.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform in Excel with Remember Password and User id option or check button

    What would be the advantage of this? Once implemented anyone could open the workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Userform in Excel with Remember Password and User id option or check button

    Why don't you make use of a Global Variable? In a module, define 2 global variables:

    Please Login or Register  to view this content.
    And, in the Submit Button event, save the UserID and Password in the global variables & in the form load event, retrieve them in the corresponding text boxes. However, when you close the file & open it again, they would be lost.

    An alternative would be to save the UserID & Password at some place in one of the sheets and retrieve them.

    But then, as Roy pointed out correctly, what is the whole point of having the UserID and Password?

    --Karan--
    Last edited by karan; 09-13-2009 at 04:31 AM. Reason: More info

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform in Excel with Remember Password and User id option or check button

    Global variables are lost when the workbook is closed.

  5. #5
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Yes guys it's true that the user id and the password will get lost when the workbook will be closed but i am going to use this userform in my excel addin. So my first question is if at all i am using the "Global Variable" option in my addin will it remember the user id and password for the particular user if he uses remember me option button in the userform, if yes how exactly it will work will it go off if the excel is closed or it will get saved somewhere in background.

    Now if you say that it will go off after closing entire excel then as far as storing user ids and passwords is concerned i think i can get them stored in an sql database which will save the login info of all the users who will use "Remember me" option button in my excel addin userform. Can you please provide me with an example code for the above.

    Thanks a lot for your help in advance.
    Last edited by abhay_547; 09-13-2009 at 09:54 AM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform in Excel with Remember Password and User id option or check button

    Global variables will be stored as long as the workbook (addin ) is active. If you want to store them permanently you can store them in a sheet in the addin or write them to the registry.

  7. #7
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Roy,

    Can you please provide me an example in the attached excel file.

    Thanks for your help in advance.
    Attached Files Attached Files

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform in Excel with Remember Password and User id option or check button

    You don't open a userform with Call, you need
    Please Login or Register  to view this content.
    I still can't understand why you need to do this, nor why you want a log in form for an addin

  9. #9
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Userform in Excel with Remember Password and User id option or check button

    Here is your example.

    I have saved the userid and password in Sheet3.

    --Karan--
    Attached Files Attached Files

  10. #10
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Roy,

    Sorry i know that i need to use "show" for a userform but I have just created that file for showing you an example that what exactly i need. One more thing i want to have this login window in my addin because i have created a addin which connects to essbase servers for retrieving data / numbers for all users and right now i have hardcoded their user id's and passwords in my excel addin which is not feasible because then every time when they change their password i will have to change their passwords in my addin also and provide them with a revised one addin file. so i am trying to have such userform. Please find the revised attachment and provide me with a sample code.

    Thanks for your help in advance.
    Attached Files Attached Files

  11. #11
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Karan,

    The code provide by you in the excel attachment doesn't work for my addin as it is refering to Sheet3 A1 and B1 cells to save login details. Can you please provide me with a code which save the passwords in the addin itself and it shouldn't go off when the entire excel is closed.

    Thanks for your help in advance.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Userform in Excel with Remember Password and User id option or check button

    Save the file as an addin (.xla). The userid and password will still be there in Sheet3 of the addin file, but it won't be visible to anyone.

  13. #13
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Quote Originally Posted by karan View Post
    Save the file as an addin (.xla). The userid and password will still be there in Sheet3 of the addin file, but it won't be visible to anyone.

    Hi Karan,

    I have checked the excel file sent by you as an .xla that is addin file but still it refers to the sheet3 of the activeworkbook that is i can see the user id and password which i enter in the userform in the cell A1 and B1 of Activeworkbook sheet3. Please expedite.

    Thanks a lot for your help in advance.

  14. #14
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Abhay,

    Try
    Please Login or Register  to view this content.
    Put 'ThisWorkbook.' at the beginning of all the lines concerned.

    --Karan--

  15. #15
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Karan,

    Yes, It's working now but still i am facing an issue with my addin file that is i close the entire excel and open it again and then try to open my userform it shows me the userid and password which was entered by me for the first time that is basically i had entered some dummy userid and password but now when i am trying to enter a working userid and password and check the "Remember Me" checkbox then it remembers the same userid and password till the excel is open but when the entire excel is closed and again opened and when i try to open the userform once again it shows me the dummy userid and password which was entered by me for the first time and not the working userid and password which were entered by me last time when the excel was open.
    Please expedite.

    Thanks a lot for your help in advance.

  16. #16
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,165

    Re: Userform in Excel with Remember Password and User id option or check button

    Place the UserID and Pword in the Registry. Even if the computer is turned off the values are still accessable.
    This would make it work for that computer only.
    Use and IF statement to compare against who is logged in the computer. As log as the user logs off the next user wont have access to the app without entering UserID and Pword.
    Examples:
    Save to registry
    Please Login or Register  to view this content.
    Read from registry.
    Please Login or Register  to view this content.
    Of course use words for UserID and Pword that arent as easily recognized.
    You could also encrypt and decrypt the values making them illegible from within the registry.
    Regards

    Rick
    Win10, Office 365

  17. #17
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,165

    Re: Userform in Excel with Remember Password and User id option or check button

    Example from your workbook.
    Please Login or Register  to view this content.
    This saves the UserID and Pword to the registry if CheckBox1 is true, if false the values saved are removed. TextBox1 and 2 will have the values displayed while textbox2 are encrypted ("*"). Everytime a user opens the app fire the userform adn as long as they select checkbox one as true, the UserID and Pword will remain the same.

    I also set values for CheckBox1 if its true or false.
    From this you can work from actual user login of the computer if you need authorization to be more indepth.

    HTH

  18. #18
    abhay_547
    Guest

    Re: Userform in Excel with Remember Password and User id option or check button

    Hi Rick,

    Can you please help me with the below :

    1) The term "YourApp" in your code refers to what ?. As per my assumption it should the exe file of Essbase program for the login of which i need userform but please clarify.

    2) As far as variables are concerned i am not sure what should i enter in place of the same.

    Here is the code used by me to connect to a essbase server.

    Sub ConnXP()
    Dim userid as String
    Dim password as string
    myuserid = Userform1.Textbox1.Value
    mypassword = userform1.Textbox2.Value
    X = EssVConnect(Null, myuserid, mypassword, "servername", "application", "database")

    End Sub
    I have attached my actual excel addin file as an xls file. Please have a look.

    Thanks for your help in advance.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Thumbs up Re: Userform in Excel with Remember Password and User id option or check button

    Hello Abhay,

    Write this one line of code at the end of Submit Button Click event:

    Please Login or Register  to view this content.
    Find the .xla file attached.

    --Karan--
    Attached Files Attached Files

  20. #20
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,165

    Re: Userform in Excel with Remember Password and User id option or check button

    Quote Originally Posted by abhay_547 View Post
    Hi Rick,

    Can you please help me with the below :

    1) The term "YourApp" in your code refers to what ?. As per my assumption it should the exe file of Essbase program for the login of which i need userform but please clarify.

    2) As far as variables are concerned i am not sure what should i enter in place of the same.

    Here is the code used by me to connect to a essbase server.



    I have attached my actual excel addin file as an xls file. Please have a look.

    Thanks for your help in advance.
    1. "YourApp" is what ever you want to call the macro, see my changes.
    I cant run most of your macro, not sure what its trying to connect to.

    Try the attached file. I have placed notes in the file.

    p.s.
    I added a macro for you to look at, shows you how to add a Tool Bar.
    Attached Files Attached Files
    Last edited by Rick_Stanich; 09-15-2009 at 02:31 PM.

  21. #21
    abhay_547
    Guest

    Thumbs up Re: Userform in Excel with Remember Password and User id option or check button

    Hi,

    Thanks a lot guys, It's working now.

Closed Thread

Thread Information

Users Browsing this Thread

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

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