Michael Miller said:
Hi John and Doug,
I just sent you a reply but of course I got a 'could not find page' error on
my posting.
I tried John's final suggestion,
should read
lngX = apiGetUserName(strUserName, lngLen)
and now the fosusername function returns my username + 1 box, so we're
gettin' somewhere. A Trim also still shows (hovering and locals window) my
name + the 1 box.
Any ideas?
fOSUserName = Left(strUserName, lngLen-1)
John
=========================================
' My version of your code after interjection by Douglas
'
Public Function fOSUserName() As String
'---------------------------------
'returns the network login name
'---------------------------------
Dim lngLen As Long
Dim lngX As Long
Dim strUserName As String
lngLen = 255 ' max allowed from api, from max filename length FAT32
strUserName = Space(lngLen)
lngX = apiGetUserName(strUserName, lngLen)
'---------------------------------
' lngX = api result
' lngLen = number of characters replaced including final Chr(0)
If (lngX > 0) Then
fOSUserName = Left(strUserName, lngLen-1)
Else
fOSUserName = vbNullString
End If
'---------------------------------
End Function
=========================================