本文介绍了如何将操作应用于选定的多个 Outlook 项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码此处有效仅限一件.如何修改它来为每个选定的项目运行 DisplayItemMetadata
(见代码)?
The code here works for one item only. How to modify that to run DisplayItemMetadata
(see the code) for each item selected?
更新.尝试执行以下操作:
Upd. tried to do the following:
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
推荐答案
需要遍历Selection对象,如下:
You need to iterate over the Selection object, as follows:
Dim individualItem As Object
For Each individualItem In Application.ActiveExplorer.Selection
'Perform some action on individualItem
Next Message
如果您有一个对单个选定项目执行操作的函数,那么您应该更改该函数以获取一个参数(要对其执行操作的项目),然后在上述循环内调用该函数.
If you have a function that performs an action on a single selected item, then you should change that function to take a parameter (the item to perform the action on) and then call that function inside the above loop.
这篇关于如何将操作应用于选定的多个 Outlook 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!