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
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