Add Method (OutlookBarShortcuts Collection) Example

The following Microsoft Visual Basic/Visual Basic for Applications example adds a shortcut to the Microsoft home page on the Web.

Dim myOlApp As New Outlook.Application
Dim myOlBar As Outlook.OutlookBarPane
Dim myolGroup As Outlook.OutlookBarGroup
Dim myOlShortcuts As Outlook.OutlookBarShortcuts
Set myOlBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
Set myolGroup = myOlBar.Contents.Groups.Item(1)
Set myOlShortcuts = myolGroup.Shortcuts
myOlShortcuts.Add "http://www.microsoft.com", _
    "Microsoft Home Page", 3

If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

Set myOlBar = _
    Application.ActiveExplorer.Panes.Item("OutlookBar")
Set myolGroup = myOlBar.Contents.Groups.Item(1)
Set myOlShortcuts = myolGroup.Shortcuts
myOlShortcuts.Add "http://www.microsoft.com", _
    "Microsoft Home Page", 3