Consulting

Results 1 to 5 of 5

Thread: Solved: Allow Authorisation On 2 Computers

  1. #1
    VBAX Tutor
    Joined
    Jan 2006
    Posts
    248
    Location

    Solved: Allow Authorisation On 2 Computers

    I have the following code that allows a user to use a program on only one specific machine, it picks up the name of the machine.

    I want to allow users to use another machine, I have tried putting in the other machines name but this does not work.

    Can anyone offer a suggestion how to overcome this?

    [vba]Private Sub Workbook_Open()

    If Environ("ComputerName") <> UCase("Bal36840") Then
    MsgBox "This Is Not An Authorised Computer, Contact The Administrator!" & vbCrLf & "(C)Barry 2011"
    Me.Close SaveChanges:=False
    Else
    '** Do your thing here
    MsgBox "You Have Authorisation To Use This Program On This Computer", , Format(Now, " dd mmm yyyy ") & ("ABC")

    MsgBox "Please Ensure You Check The Fortnight Ending Date Before Printing TimeSheets", , Format(Now, " dd mmm yyyy ") & ("ABC")




    End If
    End Sub[/vba]

    I have tried changing this line:

    [vba]If Environ("ComputerName") <> UCase("fuj36840", "fuj18369") Then[/vba]

    To

    [vba]If Environ("ComputerName") <> UCase("Bal36840", "Bal18369") Then[/vba]


    Thanks for any ideas.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]If Left(UCase(Environ("ComputerName")),3) <> "BAL" Then[/VBA]

  3. #3
    VBAX Tutor
    Joined
    Jan 2006
    Posts
    248
    Location
    Kenneth, thanks for the reply, that is not working.

    The 2 machines that I want to authorise names are in this line.

    [VBA]
    If Environ("ComputerName") <> UCase("Bal36840", "Bal18369") Then
    [/VBA]

    When I put your line of code in it gave me the message box not an authorised computer as it should if it does not match the machine.

  4. #4
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]If Environ("ComputerName") <> UCase("Bal36840") And Environ("ComputerName") <> Ucase("Bal18369") Then[/VBA]
    ------------------------------------------------
    Happy Coding my friends

  5. #5
    VBAX Tutor
    Joined
    Jan 2006
    Posts
    248
    Location
    Thanks CatDaddy thats has done the trick, thanks also to Kenneth for your time, I will mark this as solved.

    Thanks again.

Posting Permissions

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