If it were me, I'd use papau's code, just changing the one line that uses
the
Script object to use the Environ("username") [ GetUSerLogged =
Environ("username") ] form that Bob Phillips provided. Environ is going
to
work on any Excel setup, whereas there's a possibility of failure with the
script on some machines, plus scripting is external to Excel and is slower
to
return the result. papau's code slightly modified:
Function GetUSerLogged()
On Error Resume Next
GetUSerLogged = Environ("username")
If Err <> 0 Then
GetUSerLogged = "Not available"
Err.Clear
End If
Thanks Pascal and Bob, shall be taking clues from your replies.
Thanks for your time.
- Kedar