Results 1 to 3 of 3

Thread: Username

  1. #1

    Username



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I have a button in my workbook. It looks at the Application.Username and if it equals a certain value, it puts some print in a cell, if not, an error pops up. This works fine on the original workbook I'm using, but once I save this as something else, it then stops at the username and executes the error. Why? I'm guessing it has something to do with the Username.

    Code:
    Private Sub CommandButton3_Click()
    Range("B50").Select
    ActiveSheet.Unprotect
    If Application.UserName = "josh" Then
    ActiveCell.Value = "Bill Kilmer"
    ActiveSheet.Protect
    ElseIf Application.UserName <> "josh" Then
    Answer = MsgBox("You are not Bill!", vbOKOnly)
    End If
    ActiveSheet.Protect
    If Sheets("Chris Burkert").Range("B50") = "Bill Kilmer" Then
    Application.Run "'SendEmailJosh'"
    End If
    End Sub

  2. #2
    I have no idea why that should happen, but using Application.Username is unreliable, the user can change it. Far better to use their login id

    Code:
    If Environ(".UserName") = "josh" Then

  3. #3
    Quote Originally Posted by Bob Phillips View Post
    I have no idea why that should happen, but using Application.Username is unreliable, the user can change it. Far better to use their login id

    Code:
    If Environ(".UserName") = "josh" Then
    I had it set to that before and then changed it

    I'm not worried about my users changing their username, but I see your point.

Posting Permissions

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