+ Reply to Thread
Results 1 to 6 of 6

code to enter password

Hybrid View

jimbolhp code to enter password 04-25-2012, 03:55 PM
Paul Re: code to enter password 04-25-2012, 04:52 PM
jimbolhp Re: code to enter password 04-25-2012, 08:20 PM
Paul Re: code to enter password 04-25-2012, 08:22 PM
vpnvipin Re: code to enter password 04-26-2012, 03:14 AM
royUK Re: code to enter password 04-26-2012, 04:47 AM
  1. #1
    Registered User
    Join Date
    10-04-2004
    Posts
    4

    code to enter password

    Greetings!

    I have a master form which is password protected. It contains a macro to open form 2. I would like to password protect form 2. My question is: What would be the command line to enter a password, i.e. newform111 when prompted by form 2?

    I really appreciate this forum. Thanks very much!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: code to enter password

    Hi Jimbo,

    You could probably use something along the lines of the following, which would be linked to a commandbutton (or other object, change as needed) on userform1:
    Private Sub CommandButton1_Click()
    Dim mypw As String, userpw As Variant
    mypw = "newform111"
    userpw = Application.InputBox("Password needed to open Form 2", "Enter Password")
    If userpw = False Then
        Exit Sub
    ElseIf userpw <> mypw Then
        MsgBox "Sorry, incorrect password entered."
    Else
        UserForm2.Show
        Unload Me
    End If
    End Sub
    If it's important that users don't know this password, you should protect your VBA code in the VB Editor (Tools > VBA Project Properties > Protection > check Lock Project for Viewing and set a password).

  3. #3
    Registered User
    Join Date
    10-04-2004
    Posts
    4

    Re: code to enter password

    Thanks for this. At the risk of showing my ignorance (probably obvious) the command is in the middle of a long complicated routine, designed to automate an order entry process. I was hoping to post information to a separate workbook in the middle of that routine without any operator input. I hope I'm being clear.

    Thanks,

    Jim Burns

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: code to enter password

    Not very clear, or at least not anything like the original request.

    My code prompts for a password when you click a command button on one form. If you enter it correctly it closes that form and opens a new form.

    If that's not what you want, provide details, the code you're working with, and a sample workbook.

  5. #5
    Registered User
    Join Date
    03-22-2012
    Location
    Bangalore, IND
    MS-Off Ver
    EXCEL 2010, 2007
    Posts
    90

    Re: code to enter password

    Hi paul,

    what command should we use to hide passwords while typing or entering in inputbox, I mean like webpages what we have to use so that others can't cme to knw or see while we type the password?
    Vipin Oceans

  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: code to enter password

    Quote Originally Posted by vpnvipin View Post
    Hi paul,

    what command should we use to hide passwords while typing or entering in inputbox, I mean like webpages what we have to use so that others can't cme to knw or see while we type the password?

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    Hope that helps.

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

    Free DataBaseForm example

+ 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