Const LogFile = "Q:\tools\user.log" Const USERS = "dnewboul,thoward,dking1,proberts,lsmithbo" Private Sub getUsername() MsgBox Environ$("Username") End Sub Sub checkUser() If Environ$("Username") = "dc" Then Exit Sub userList = Split(USERS, ",") found = False For Each user In userList If user = Environ$("Username") Then found = True Next If found Then 'MsgBox "Found" writeLog (Environ$("Username")) Else 'MsgBox "Not found" writeLog ("*** " & Environ$("Username")) quitNoSave End If End Sub Sub writeLog(user) On Error GoTo ErrorHandler ' Enable error-handling routine. Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fs, f Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile(LogFile, ForAppending, -2) f.Write Now() & vbTab & user & vbTab & PROJECT & " " & VER & Chr(13) f.Close Exit Sub ErrorHandler: ' Error-handling routine. ' MsgBox "Error# " & Err.Number, vbInformation, "Error" Select Case Err.Number ' Evaluate error number. Case 55 ' "File already open" error. Close #1 Case Else ' Handle other situations here... End Select End Sub