Extracting part of an Outlook item

I have one Outlook Item which has lots of messages in the body.

Is it possible to extract only the last message? Using Left function maybe?

Example of a body that has two messages (I need to extract just the first message)

**From: dot@dot.com.br
To: aw@yahoo.com.br
Subject: Testing

Hi, this is FIRST test.

Thanks.

John Doe
Telephone: 555 21803**



From: dot@dot.com.br
To: aw@yahoo.com.br
Subject: Testing

Hi, this is the SECOND test.

Thanks.

John Doe
Telephone: 555 21803

Answers


Sub GetMessageFromMail()

    Dim mi As MailItem
    Dim vaMessages As Variant

    'Get the email item - your method will be different
    Set mi = ActiveInspector.currentItem

    'Split the body into an array. Every time it sees the
    'string 'From:' it creates a new array item
    vaMessages = Split(mi.Body, "From:")

    'The 0th message will be the two asterisks that precede the
    'From: so to get the first message we need the 1 index of
    'our zero based array
    Debug.Print vaMessages(1)

    'Or you could get the last message by using UBound
    Debug.Print vaMessages(UBound(vaMessages))

End Sub

Need Your Help

Is Setters can have more than one argument? If it's how it useful?

java javabeans

Most of them thinking like in "setX() & getX()" X is name.(my intention is in place of X you can take any Name )

Can't update a tableview automatically

ios tableview

I have a view controller with many views and a tableview.