• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to copy specific text from the body of the email?

Sajjad Haider

New Member
Screen Shot 2018-12-20 at 13.32.42.png
Code:
Option Explicit
Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNs As Outlook.Namespace
Dim olFldr As Outlook.MAPIFolder
Dim olItms As Outlook.Items
Dim olMail AsVariantDim i AsLong
Set olApp =New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")Set olFldr = olNs.GetDefaultFolder(olFolderInbox).Folders("impMail")
Set olItms = olFldr.Items
olItms.Sort "Subject"
ForEach olMail In olItms If InStr(olMail.Subject,"SubjectoftheEmail")>0  Then

ThisWorkbook.Sheets("Fixings").Cells(2,2).Value = olMail.Body
EndIf
Next olMail
Set olFldr =Nothing
Set olNs =Nothing
Set olApp =Nothing
EndSub

This code help me to download whole body of the email but i need specific bold text in cells.The email body is as follows.

@ABC4: please add the following detail in system (for 12-Jan-2019):

12345_ABC_MakOpt --- 264532154.78
12345_ABC_GAPFee --- 145626547.80


Thanks
 
Last edited:
Back
Top