1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. 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...

  3. 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?

Discussion in 'VBA Macros' started by Sajjad Haider, Jan 14, 2019.

  1. Sajjad Haider

    Sajjad Haider New Member

    Messages:
    2
    Screen Shot 2018-12-20 at 13.32.42.png
    Code (vb):

    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: Jan 14, 2019

Share This Page