complte username about domain and usename

User avatar
sal21
PlatinumLounger
Posts: 4346
Joined: 26 Apr 2010, 17:36

complte username about domain and usename

Post by sal21 »

I dont know if is possible...
Hans, please take a eyes here!
I know the username s.a. OU1234556 and domain name MYDOMAIN is possibleb to have the complete name of username similar Jhon Smith?
Please with vb6 or vba for excel

User avatar
HansV
Administrator
Posts: 78402
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: complte username about domain and usename

Post by HansV »

I'm sure it's possible, but I have no idea how to do that.
Best wishes,
Hans

User avatar
Leif
Administrator
Posts: 7208
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: complte username about domain and usename

Post by Leif »

Leif

User avatar
HansV
Administrator
Posts: 78402
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: complte username about domain and usename

Post by HansV »

Leif, the code posted there will return the Windows login name, "OU1234556" in Sal21's example.

On a domain, the full name of the user ("Jhon Smith") may be available in Active Directory (AD). I interpreted Sal's question to be how to extract the full name from AD if you know the login name.

I found some old code that says it's for Windows NT and 2000; I suppose it'll work for Windows XP too, but I have no idea whether it'll work in Windows Vista or Windows 7 on a domain. (On my home PC, it returns an empty string).

I have attached the code, for what it's worth. It should be copied into a module.
GetUsername.txt
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4346
Joined: 26 Apr 2010, 17:36

Re: complte username about domain and usename

Post by sal21 »

HansV wrote:Leif, the code posted there will return the Windows login name, "OU1234556" in Sal21's example.

On a domain, the full name of the user ("Jhon Smith") may be available in Active Directory (AD). I interpreted Sal's question to be how to extract the full name from AD if you know the login name.

I found some old code that says it's for Windows NT and 2000; I suppose it'll work for Windows XP too, but I have no idea whether it'll work in Windows Vista or Windows 7 on a domain. (On my home PC, it returns an empty string).

I have attached the code, for what it's worth. It should be copied into a module.
GetUsername.txt
l.

Sure Hans this is exactlly wath i need!!!!!!!!!!!!!!!!
Only you!
Sa

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: complte username about domain and usename

Post by StuartR »

HansV wrote:...I have no idea whether it'll work in Windows Vista or Windows 7 on a domain...
It worked correctly for me, using a Windows Vista PC logged into my work domain via a VPN connection.
StuartR


User avatar
HansV
Administrator
Posts: 78402
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: complte username about domain and usename

Post by HansV »

Thanks for the confirmation, Stuart!
Best wishes,
Hans