Announcement

Collapse
No announcement yet.

If statement to run for more than 1 person

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • If statement to run for more than 1 person

    I'm writing a script and want to map a different drive for three people out of the entire group. How can I write the If to include all three instead of three individual if statements?

    For example,

    If strUserName = "JDoe" Then
    Call MapUserDrive ("I:", "\\ server name \ share")
    End if

    How do I make the same true for "JDean" and "BWayne" without writing two more individual if statements?

    Thanks

  • #2
    Re: If statement to run for more than 1 person

    IF strUserName = "userA" or strUserName = "userB" or strUserName = "userC" Then
    do x
    Else
    do y
    End if


    You could also use a Select Case statement, but that will require a line for each user ending with a CASE ELSE for the rest of the people.
    Jake G

    Former Microsoft MVP - IIS ('02-'06)

    Comment


    • #3
      Re: If statement to run for more than 1 person

      Thank you, I knew it was something simple and easy but for some reason I couldn't get it right. Thanks

      Comment

      Working...
      X