Folder.Display Method

Outlook Developer Reference

Displays a new Explorer object for the folder.

Version Information
 Version Added:  Outlook 2007

Syntax

expression.Display()

expression   A variable that represents a Folder object.

Example

This Visual Basic for Applications (VBA) example uses the Display method to display the default Inbox folder. This example will not return an error, even if there are no items in the Inbox, because you are not asking for the display of a specific item.

Visual Basic for Applications
  Sub DisplayInbox()
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.Folder
	
    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    myFolder.Display
End Sub

This Visual Basic for Applications example displays the first item in the Inbox folder. This example will return an error if the Inbox is empty, because you are trying to display a specific item. If there are no items in the folder, a message box will be displayed to inform the user.

Bb147819.vs_note(en-us,office.12).gif  Note
The items in the Items collection object are not guaranteed to be in any particular order.
Visual Basic for Applications
  Sub DisplayFirstItem()
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.Folder
	
    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    On Error GoTo ErrorHandler
    myFolder.Items(1).Display
    Exit Sub
ErrorHandler:
    MsgBox "There are no items to display."
End Sub

See Also