Class OutlookBarShortcuts (Outlook VBA)
Contains a set of OutlookBarShortcut objects representing all shortcuts in a group in the Shortcuts pane. To use a OutlookBarShortcuts class variable it first needs to be instantiated, for example
Dim obss as OutlookBarShortcuts
Set obss = ActiveExplorer.Panes(1).Contents.Groups(1).Shortcuts
Add
Adds a new shortcut to a group in the Shortcuts pane.
Sub AddShortcut()
Dim myOlBar As Outlook.OutlookBarPane
Dim myolGroup As Outlook.OutlookBarGroup
Dim myOlShortcuts As Outlook.OutlookBarShortcuts
Set myOlBar = Application.ActiveExplorer.panes.Item("OutlookBar")
Set myolGroup = myOlBar.Contents.Groups.Item(1)
Set myOlShortcuts = myolGroup.Shortcuts
myOlShortcuts.Add "https://www.microsoft.com", _
"Microsoft Home Page", 1
End Sub
Arguments
The following arguments are required:
Target - The target of the shortcut being created
Name (String) - The name of the shortcut being created.
Optional arguments
The following argument is optional
Index (Long) - The position at which the new shortcut will be inserted in the Shortcuts pane group. Position one is at the top of the group.The Target type depends on the shortcut type. If the type is Folder, the shortcut represents a Microsoft Outlook folder. If the type is a String, the shortcut represents a file-system path or a URL.
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = ActiveExplorer.Panes(1).Contents.Groups(1).Shortcuts.Class
Count
Returns a Long indicating the count of objects in the specified collection.
Dim lngCount As Long
lngCount = ActiveExplorer.Panes(1).Contents.Groups(1).Shortcuts.Count
Item
Returns an OutlookBarShortcut object from the collection.
Item (Index)
Index: Either the index number of the object, or a value used to match the default property of an object in the collection.
Dim obs As OutlookBarShortcut
Set obs = ActiveExplorer.Panes(1).Contents.Groups(1).Shortcuts(Index:=1)
Remove
Removes an object from the collection.
Remove (Index)
Index: The name or 1-based index value of an object within a collection.
Dim lngIndex As Long: lngIndex =
ActiveExplorer.Panes(1).Contents.Groups(1).Shortcuts.Remove Index:=lngIndex
Session
Returns the NameSpace object for the current session.
The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements do the same function: