insert username

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • countryboy
    New Member
    • Jul 2007
    • 13

    insert username

    the (NOW) command inserts the system time. Is there a way to insert the user name of the person logged on to a xp machine?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try to use this

    [code=vb]
    Private Declare Function GetUserName Lib "advapi32.d ll" Alias "GetUserNam eA" (ByVal lpBuffer As String, nSize As Long) As Long

    Public Function localUserName() As String
    Dim m_myBuf As String * 25
    Dim m_Val As Long, UserName As String

    m_Val = GetUserName(m_m yBuf, 25)
    localUserName = Left(m_myBuf, InStr(m_myBuf, Chr(0)) - 1)
    End Function

    [/code]

    Comment

    Working...