sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,404
- Office Version
- 2016
- Platform
- Windows
I have been using a macro to import the body of an Outlook message from Excel, this has worked flawlessly in Officer 2013. I have recently upgraded to Office 2016 and now it won't work.
The routine is able to read Outlook fine, (other parts of the module count how many emails have a certain subject line), but it fails on the line which tries to read the email body. For info, I have checked the Outlook settings and they are identical to what was in 2013.
My code:
and this is the line that fails:
Has anyone experienced this and can point me towards a solution?
The routine is able to read Outlook fine, (other parts of the module count how many emails have a certain subject line), but it fails on the line which tries to read the email body. For info, I have checked the Outlook settings and they are identical to what was in 2013.
My code:
VBA Code:
Dim objNS As Outlook.Namespace
Dim objFolder As Outlook.MAPIFolder
Set objNS = GetNamespace("MAPI")
Application.ScreenUpdating = False
Set objFolder = objNS.Folders("DEMAND PROJECT Mailbox").Folders("Inbox")
Set DestFolder = objNS.Folders("DEMAND PROJECT Mailbox").Folders("Emails")
For Each Item In objFolder.Items
If InStr(Item.Subject, "Demand Data") Then
Body = Item.Body
and this is the line that fails:
VBA Code:
Body = Item.Body
Has anyone experienced this and can point me towards a solution?