Problem: Outlook VBA Recall Messages
I am using VBA to validate Message Types in Outllok so that it only looks at mailItems. However, I need to ensure that VBA does not fall over when a message is recalled by a user. Can the following be restructured to remove these recall messages
Dim fdrContacts As Outlook.MAPIFolder
Dim objContactItem As Object
‘Dim objContactItem As Object
Set fdrContacts = Application.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox)
Set fdrDest = fdrContacts.Folders(“AutoTicket Backup”)
For Each objContactItem In fdrContacts.Items
readSubject = LCase(objContactItem.Subject)
‘If InStr(readSubject, “recall:”) Then
‘objContactItem.Delete
If TypeName(objContactItem) <> “MailItem” Then
objContactItem.Move (fdrDest)
End If
Next
Solution: Outlook VBA Recall Messages
Instead of checking the subject line for the word “recall” try testing the message’s MessageClass property for IPM.Outlook.Recall. I also recommedn testing the item’s Class property rather than using TypeName. For messages Class will equal olMail.