Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Taje user name to look up department

Status
Not open for further replies.

wdverner

Technical User
Mar 10, 2005
160
GB
Hi All,
I have retrieved the logged on user via
strUserName = objNetwork.UserName

What I want to do now is to look up what Department this user works in as specified in the users profile within Active Directory.

I can do this by specifying a username:
Set objUser = GetObject _
("LDAP://cn=ENTER USER HERE,cn=users,dc=MyDomain,dc=DC01,dc=com")

What I want is for the LDAP to take strusername and use this in place of what I manually type e.g. MY USER NAME.

Is this possible?

Thanks guys
 
You wanted this ?
Set objUser = GetObject _
("LDAP://cn=" & strUserName & ",cn=users,dc=MyDomain,dc=DC01,dc=com")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,
Thanks for the reply, no tried that and it doesnt want to know!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top