Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Active Directory and UserName
Hi,
I was wondering, is there way to retrieve the Display Name as shown under Active Directory, from VBA if the only available info is the logon Username? I'm running Windows2000 & above, Office 2000, Server2003 Std. Thanks Augustus |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Active Directory and UserName
Here is the NT username. Not sure if this is what you want, but I think so...
Option Explicit Private Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Function ReturnNTUserName() As String ' Returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String Dim NWUserName As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error GoTo 0 NWUserName = Left(Right(tString, Len(tString) - 1), Len(tString) - 2) ReturnNTUserName = UCase(Left(tString, 1)) + NWUserName + Right(UCase(tString), 1) End Function "augustus" wrote: Hi, I was wondering, is there way to retrieve the Display Name as shown under Active Directory, from VBA if the only available info is the logon Username? I'm running Windows2000 & above, Office 2000, Server2003 Std. Thanks Augustus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel active directory | Setting up and Configuration of Excel | |||
Active directory users | Excel Programming | |||
active directory? | Excel Programming | |||
Active Directory | Excel Programming |