设置指定 Microsoft Outlook 面板快捷方式的图标。
expression.SetIcon(Icon)
expression 必选。该表达式返回 OutlookBarShortcut 对象。
Icon 必选,Variant 类型。图标的路径。
以下示例将所有指向 MAPIFolder 对象的快捷方式的图标设置为图像 Mail.ico(位于用户计算机上)。本示例假设指定位置存在该图标。
Sub SetFolderIcon()
Dim OlApp As New Outlook.Application
Dim objOlBar As Outlook.OutlookBarPane
Dim objolGroup As Outlook.OutlookBarGroup
Dim objOlShortcuts As Outlook.OutlookBarShortcuts
Dim objOlShortcut As Outlook.OutlookBarShortcut
Dim intTop As Integer
Dim i As Integer
Set objOlBar = OlApp.ActiveExplorer.Panes.Item("OutlookBar")
Set objolGroup = objOlBar.Contents.Groups.Item(1)
Set objOlShortcuts = objolGroup.Shortcuts
intTop = objOlShortcuts.Count
For i = intTop To 1 Step -1
Set objOlShortcut = objOlShortcuts.Item(i)
If TypeName(objOlShortcut.Target) = "MAPIFolder" Then
objOlShortcut.SetIcon _
("C:\Program Files\Microsoft Office\Office\forms\1033\Mail.ico")
End If
Next i
End Sub