+ Reply to Thread
Results 1 to 3 of 3

Password in a macro

  1. #1
    ordnance1
    Guest

    Password in a macro

    I have a macro which requests a password before allowing one to change a
    worksheet. I do not want the password to be case sensitive. My code follows:

    On error GoTo Error
    If TextBox1.Text <> "groupproject" Then
    Unload UserFormPassword

    GoTo Error
    Exit Sub
    Else Unload Password_UserForm
    New_Or_Edit.Show

    End If
    Exit Sub
    Error:

    Unload Password_UserForm
    Invalid_Password.Show


    What can be done to make this NOT case sensitive?

  2. #2
    Jim Thomlinson
    Guest

    RE: Password in a macro

    Use the UCase (or LCase) function to check the Upper case value of what was
    entered against the Upper case value of the password. Make sure to UCase both
    sides (the entry and the password).
    --
    HTH...

    Jim Thomlinson


    "ordnance1" wrote:

    > I have a macro which requests a password before allowing one to change a
    > worksheet. I do not want the password to be case sensitive. My code follows:
    >
    > On error GoTo Error
    > If TextBox1.Text <> "groupproject" Then
    > Unload UserFormPassword
    >
    > GoTo Error
    > Exit Sub
    > Else Unload Password_UserForm
    > New_Or_Edit.Show
    >
    > End If
    > Exit Sub
    > Error:
    >
    > Unload Password_UserForm
    > Invalid_Password.Show
    >
    >
    > What can be done to make this NOT case sensitive?


  3. #3
    Patrick Simonds
    Guest

    Re: Password in a macro

    Thanks!

    Could not get that to work the way I wanted, but came up with this:

    With TextBox1
    .Value = LCase(.Value)
    End With

    Placed at the beginning of my code, it did the job.

    "Jim Thomlinson" <[email protected]> wrote in message
    news:[email protected]...
    > Use the UCase (or LCase) function to check the Upper case value of what
    > was
    > entered against the Upper case value of the password. Make sure to UCase
    > both
    > sides (the entry and the password).
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "ordnance1" wrote:
    >
    >> I have a macro which requests a password before allowing one to change a
    >> worksheet. I do not want the password to be case sensitive. My code
    >> follows:
    >>
    >> On error GoTo Error
    >> If TextBox1.Text <> "groupproject" Then
    >> Unload UserFormPassword
    >>
    >> GoTo Error
    >> Exit Sub
    >> Else Unload Password_UserForm
    >> New_Or_Edit.Show
    >>
    >> End If
    >> Exit Sub
    >> Error:
    >>
    >> Unload Password_UserForm
    >> Invalid_Password.Show
    >>
    >>
    >> What can be done to make this NOT case sensitive?




+ 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