Returns or sets the display name for an object in the Applies To list. 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 (VBA) example uses the Name property to obtain the name of the folder displayed in the active explorer.
Sub DisplayCurrentFolderName()
Dim myOlApp As Outlook.Application
Dim myExplorer As Outlook.Explorer
Dim myFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myExplorer = myOlApp.ActiveExplorer
Set myFolder = myExplorer.CurrentFolder
MsgBox myFolder.Name
End Sub
If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object. This example shows how to perform the same task using VBScript code.
Sub CommandButton1_Click()
Set myExplorer = Application.ActiveExplorer
Set myFolder = myExplorer.CurrentFolder
MsgBox myFolder.Name
End Sub