Richard said:
The standard method is to use the ADSystemInfo object. The UserName
attribute of the object is the DN of the current user:
=====
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
========
An error is raised if the user is not authenticated to a domain. In
VB you must add a reference to "Active DS Type Library" (which is
activeds.tlb). I've never done this in VBA.
It does work in VBA. Also, once you've added the reference to the ADS
library, you can use early binding, which gives you IntelliSense support.
Sub x()
Dim objSysInfo As ADSystemInfo
Dim strUserDN As String
Set objSysInfo = New ADSystemInfo
strUserDN = objSysInfo.UserName
MsgBox strUserDN
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.