How to apply the action to several Outlook items selected?
-
29-10-2019 - |
문제
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
해결책
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.
제휴하지 않습니다 StackOverflow