Name Property

Microsoft Outlook Visual Basic

Show All

Name Property

       

Returns or sets the display name for the item. The Name property is also the caption for a form. Read/write depending on the object.

expression.Name

expression   Required. An expression that returns one of the objects in the Applies To list.

Note The Name property must be set before you can use the PublishForm method. It is also necessary for the Name property to be set before calling the Details method.

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