Real Users Name Not Lan ID

L

Lime

Hello,
Question, I would like to have a VB Macro that auto populates a Textbox1
with the real name of the user of the form. This form will be used on a very
lage network and people sign on with lan ID's. For example My lan is Rk9954
but my real name is Joe Shmoe. When I use Environ("username") is puts out the
lan ID as the user. What I need its it to display the Real name of the user.

any Help?
Lime
 
M

Michel Pierron

Hi Lime,
You can try:

Sub GetFullName()
Dim Domain$, User$
With CreateObject("Wscript.Network")
Domain = .UserDomain: User = .username
End With
MsgBox GetObject("WinNT://" & Domain & "/" & User & ",user").fullname, 64
End Sub

MP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top