marzi
asked on
Retrieving Novell NetWare username and passing it to a label
There is another thread here somewhere that was asking how he could retrieve the novell network username with 2000/XP machines (i can only retrive the local machine username at this point) and it was agreed the best method was to use:
Debug.Print Environ("nwusername")
However, being the beginner that i am, i can't get this value to display anywhere. What i want to do is use that line of code to get the username and then pass the value to a label to be displayed on my form. I hope this makes sense (it doesn't make much to me)? Even if i can get the value into a variable or something i can go from there.
Thanks
Debug.Print Environ("nwusername")
However, being the beginner that i am, i can't get this value to display anywhere. What i want to do is use that line of code to get the username and then pass the value to a label to be displayed on my form. I hope this makes sense (it doesn't make much to me)? Even if i can get the value into a variable or something i can go from there.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm not overly skilled in vb... but i can gaurantee you i should have really something other than debug.print should could equal the variable. I was thinking of it as a whole statement... pretty stupid :-)
Thanks shane... you right on the $$$.
Thanks shane... you right on the $$$.
ASKER
That meant to say... but i can gaurantee you i should have realised something other than debug.print can equal the variable...
Declare Function WNetGetUser& Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName$, ByVal lpUserName$, BufLen&)
Public Function GetNovellUserID()
Dim lpName As String, NovellUserLoginID As String
NovellUserLoginID = Space$(55)
WNetGetUser& lpName$, NovellUserLoginID, Len(NovellUserLoginID)
GetNovellUserID = Left$(NovellUserLoginID, InStr(NovellUserLoginID, Chr$(0)) - 1)
End Function
Private Sub ShowMe()
MsgBox GetNovellUserID()
End Sub