Search Tools Links Login

Get current Outlook user

Retrieve the user currently logged on in the existing Microsoft Outlook session.

Original Author: Klemens Schmid


Open a new VB project. Add a button to the form. Add a reference to "Microsoft Outlook ...". Paste the code into the form. Run the project.


Returns the Name property of the recipient object.


Private Sub cmdUser_Click()
'get the user from the current Outlook session
Dim ol As Outlook.Application
Dim ns As NameSpace
Dim oRec As Recipient
Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Call ns.Logon(, , , False)
Set oRec = ns.CurrentUser
MsgBox oRec.Name
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 90 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.