I have the save the attachments part working but when i try to move the email to a different folder i get a run-time error 13 type mismatch. here is the new code. Could anyone shed some light on this for me. Thank you.
Code:
For Each Item In olSubFolder.Items
Set rsOpen = db.OpenRecordset("tbl_EmailInfo")
For Each Attachment In Item.Attachments
If Attachment.Type = 1 And (InStr(Attachment, "xlsx") Or InStr(Attachment, "xls")) > 0 Then
rsOpen.AddNew
rsOpen![DateEmailRcvd] = Item.ReceivedTime
rsOpen![AttachmentName] = Attachment.FileName
rsOpen.Update
FileName = networkFilepath & Attachment.FileName
Debug.Print Attachment.FileName
Attachment.SaveAsFile FileName
End If
Next Attachment
If TypeOf Item Is Outlook.MailItem Or Item.Class = 43 Or TypeOf Item Is Outlook.ReportItem Then
Item.Move (olDestFolder)
End If
Next Item