CurrentUser Property

Microsoft Outlook Visual Basic

CurrentUser Property

       

Returns the currently logged-on user as a Recipient object.

expression.CurrentUser

expression    Required. An expression that returns a NameSpace object.

Example

This Visual Basic for Applications example uses the CurrentUser property to obtain the name of the currently logged-on user and then displays a message box containing the name.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
MsgBox myNameSpace.CurrentUser.Name

If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

Set myNameSpace = Application.GetNameSpace("MAPI")
MsgBox myNameSpace.CurrentUser.Name