PDA

View Full Version : Loop Through Multiple Selected Mail Item



smartbuyer
04-19-2018, 07:05 PM
I am having issues on my 'For Next' statement and getting an "Operation Failed" error.

the error shows up when x = 2



For x = 1 To myOlSel.Count
Set oMail = myOlSel.item(x)
Set MyCurrentFolder = myOlExp.CurrentFolder

If (TypeOf myOlSel.item(x) Is MailItem) Then
oMail = myOlSel.item(x)
' code here to get mail item metadata (subject, conversationID, received time, category etc)


End If
oMail.UnRead = False
Next x

SamT
04-21-2018, 10:09 AM
Moderator Bump

skatonni
04-23-2018, 09:56 AM
Set oMail = myOlSel.item(x)

Likely there are more problems. If so, put enough code for responders to run, instead of having to guess what you have.