Edit this email so it only imports the reply body text from an email

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I have this email that is brilliant and brings all all my email data from a folder into my excel sheet,

The only problem is this line,
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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Everyone,
I have this email that is brilliant and brings all all my email data from a folder into my excel sheet,

The only problem is this line,
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
Hi Everyone, Sorry for some reason I used the word Email when I meant MACRO! please change i your heads as i cant, I'll repost if it lets me.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top