View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Insert user's logon name in to cell in worksheet

All you need is

Public Function UserName() As String
Application.Volatile
UserName = Environ("UserName")
End Function

It is not a good idea to use APplication.Username as the user can change
that, there is no consistency. On a network, the login name is usually
protected against change by an individual.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ivory_kitten" wrote in message
...
I'm sorry, I don't speak your language. Do you know english?

"Francisco Parrilla" wrote:

Hi

Sub InfoDeWindows()
With CreateObject("WScript.Network")
MsgBox "Por Windows_Scripting:" & vbCr & _
"Nombre del equipo: " & .ComputerName & vbCr & _
"Nombre del dominio: " & .UserDomain & vbCr & _
"Nombre del usuario: " & .UserName & vbCr & vbCr & _
"Por variables del entorno:" & vbCr & _
"Nombre del equipo: " & Environ("computername") & vbCr

& _
"Nombre del dominio: " & Environ("userdomain") & vbCr

& _
"Nombre del usuario: " & Environ("username")
End With
End Sub

Saludos :)
Atte.
?T Francisco T?
http://groups.msn.com/ExcelVbaMacrosOffice
http://groups.msn.com/dadyboy
http://search.microsoft.com/?mkt=es-ES

"El progreso debe ser un movimiento ordenado y racional hacia una meta
fija... y no un torbellino de direcciones falsas y encontradas."