Visual Basic Programming Code Examples Visual Basic > Windows and Controls Code Examples Get the current username Get the current username 'on a Module Declare Function wu_WNetGetUser% Lib "USER.EXE" alias "WNetGetUser" (ByVal szUser$, lpnBufferSize%) Global NovellName$ Function NetworkUserID () As String dim szUser As String * 255 dim lpnBufferSize% dim status% lpnBufferSize = 255 status% = wu_WNetGetUser(szUser, lpnBufferSize) If status% = 3 Then NetworkUserID = "Error" Unload form1 Else NetworkUserID = Left$(szUser, InStr(szUser, Chr(0)) - 1) end If End Function 'Use as: NovellName = NetworkUserID() Return