Display Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
For an Explorer or MAPIFolder object, the Display method displays a new Explorer object for the folder.
For specified Microsoft Outlook items, the Display method displays a new Inspector object for the item.
Note The Display method is supported for explorer and inspector windows for the sake of backward compatibility. To activate an explorer and inspector window, use the Activate method.
expression**.Display(Modal)**
expression Required. An expression that returns one of the objects in the Applies To list.
Modal This argument is used with all objects in the Applies To list except for the Explorer and MAPIFolder objects. Optional Variant. True to make the Inspector object modal. The default value is False.
Example
This Visual Basic for Applications 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.
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
myFolder.Display
If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.
Set myNameSpace = Application.GetNameSpace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(6)
myFolder.Display
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 attempting to display a specific item. If there are no items in the folder, a message box will be displayed to inform the user.
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.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! "