tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
"Hi Everyone,
I have this Macro that is brilliant and brings in all my email data from a folder in outlook into my excel sheet,
The only problem is this line,
"ws.Range("F" & r).Value = olMail.Body"
because people are replying to my email it brings in everything including my original email.
now i need to auto a check to see if they have replied yes or no which i can do but I need the text body to only be the reply not everything
is there any way we can check my macro so it only brings in the reply body text?
thanks
Tony
Heres my code:
VBA Code:Sub ExtractEmailContent() Dim olApp As Outlook.Application, olNs As Namespace, olFolder As MAPIFolder, _ olMail As MailItem, eFolder As folder, ws As Worksheet Set ws = ActiveSheet Set olApp = New Outlook.Application Set olNs = olApp.GetNamespace("MAPI") Dim fldr As Outlook.MAPIFolder Set fldr = olNs.GetDefaultFolder(olFolderInbox).Folders("Replys") r = 2 For Each olMail In fldr.Items ws.Range("A" & r).Value = olMail.Subject ws.Range("B" & r).Value = olMail.ReceivedTime ws.Range("C" & r).Value = olMail.SenderName ws.Range("D" & r).Value = olMail.cc ws.Range("F" & r).Value = olMail.Body ws.Range("E" & r).Value = olMail.SenderEmailAddress r = r + 1 Next End Sub