Panes Property

Microsoft Outlook Visual Basic

Returns a Panes collection object representing the panes displayed by the specified explorer.

expression.Panes

expression    Required. An expression that returns an Explorer object.

Example

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example adds a group named "Marketing" as the second group in the Shortcuts pane.

Sub AddGroup()
	Dim myOlApp As New Outlook.Application
	Dim myolBar As Outlook.OutlookBarPane
	Set myolBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
	myolBar.Contents.Groups.Add "Sales", myolBar.Contents.Groups.Count + 1
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.

Set myolBar = Application.ActiveExplorer.Panes.Item("OutlookBar")
myolBar.Contents.Groups.Add "Marketing", myolBar.Contents.Groups.Count + 1