If you want the full name of the user, use the NameSpace.CurrentUser
property. If you want the name of their Windows login account, use this code:
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function FindUserName() As String
Dim strBuffer As String
Dim lngSize As Long
strBuffer = String(100, " ")
lngSize = Len(strBuffer)
If GetUserName(strBuffer, lngSize) = 1 Then
FindUserName = Left(strBuffer, lngSize)
Else
Exit Function
End If
'ELIMINATES NULL CHARACTERS
FindUserName = Replace(FindUserName, Chr(0), "")
End Function
--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog:
http://blogs.officezealot.com/legault/
"J Streger" wrote:
> I am writing a procedure in VBA, in Excel that will pull the appointment
> information from Outlook to Excel. What I also want to do is pull the account
> name from Outlook, so I know who is working on the excel sheet, since not
> everyone has set their properties the same. I can't find the command string
> to get this string property. Does anyone know how or if this information can
> be gleaned from an Excel macro? Thanks.
>
> --
> *********************
> J Streger
> MS Office Master 2000 ed.
> MS Project White Belt 2003
>