Question : Outlook VBA mail Type

Hello,

I need to validate using VBA in outlook the type of mail coming in. As Mails are fine but read receipts are creating runtime error 13 type mismatch. I have tried declaring the mail item as type Outlook.Reportitem with no luck

Sub moveReceipt()

    Dim fdrContacts As Outlook.MAPIFolder
  Dim objContactItem As Outlook.ReportItem
   

  'Create an instance of the Contacts folder and destination folder
  Set fdrContacts = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
  Set fdrDest = fdrContacts.Folders("AutoTicket Backup")
 
 
 

      For Each objContactItem In fdrContacts.Items
 
       
        If objContactItem.Class = olReport Then
            objContactItem.Move (fdrDest)
       
       End If
           
       
       
  Next
   
       
   

End Sub

Answer : Outlook VBA mail Type

Take your time, and let me know if you need anything else!
Matt
Random Solutions  
 
programming4us programming4us