全部显示

Target 属性

       

返回 Outlook 面板组中指定快捷方式的目标。Variant 类型,只读。

expression.Target

expression   必选。该表达式返回 OutlookBarShortcut 对象。

说明

返回的类型依赖于快捷方式的类型。如果该快捷方式代表 Microsoft Outlook 文件夹,那么返回类型为 MAPIFolder。如果该快捷方式代表文件系统文件夹,那么返回类型为 Object。如果该快捷方式代表文件系统路径或 URL,那么返回类型为 String

示例

本 Microsoft Visual Basic/Visual Basic for Applications 示例遍历第一个“Outlook 面板”组中的快捷方式。如果找到不是 Outlook 文件夹的快捷方式,则删除它。

Dim myOlApp As New Outlook.Application
Dim myOlBar As Outlook.OutlookBarPane
Dim myolGroup As Outlook.OutlookBarGroup
Dim myOlShortcuts As Outlook.OutlookBarShortcuts
Dim myOlShortcut As Outlook.OutlookBarShortcut
Set myOlBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
Set myolGroup = myOlBar.Contents.Groups.Item(1)
Set myOlShortcuts = myolGroup.Shortcuts
myTop = myOlShortcuts.Count 
For x = myTop To 1 Step -1
    Set myOlShortcut = myOlShortcuts.Item(x)
    If TypeName(myOlShortcut.Target) <> "MAPIFolder" Then
        myOlShortcuts.Remove x
    End If
Next x

如果使用 VBScript,则不必创建 Application 对象。本示例说明如何使用 VBScript 执行相同任务。

Set myOlBar = _
    Application.ActiveExplorer.Panes.Item("OutlookBar")
Set myolGroup = myOlBar.Contents.Groups.Item(1)
Set myOlShortcuts = myolGroup.Shortcuts
myTop = myOlShortcuts.Count 
For x = myTop To 1 Step -1
    Set myOlShortcut = myOlShortcuts.Item(x)
    If TypeName(myOlShortcut.Target) <> "MAPIFolder" Then
        myOlShortcuts.Remove x
    End If
Next