代码here仅适用于一个项目。如何修改它以便为所选的每个项目运行DisplayItemMetadata
(参见代码)?
UPD。试图做到以下几点:
For Each individualItem In Application.ActiveExplorer.Selection
With objButton
.BeginGroup = True
.Caption = "My &item"
.FaceId = 1000
.Tag = "DisplayItemMetadata"
If Not IsNull(Selection.Item(1)) Then
On Error GoTo 0
' Just in case the item selected
' doesn't have a valid EntryID.
' .Parameter = Selection.Item(1).EntryID
.Parameter = individualItem.EntryID
On Error GoTo ErrRoutine
End If
.OnAction = _
"Project1.ThisOutlookSession.DisplayItemMetadata"
End With
Next individualItem
答案 0 :(得分:4)
您需要迭代Selection对象,如下所示:
Dim individualItem As Object
For Each individualItem In Application.ActiveExplorer.Selection
'Perform some action on individualItem
Next Message
如果你有一个对单个选定项目执行操作的函数,那么你应该更改该函数以获取一个参数(该项目执行操作),然后在上面的循环中调用该函数。