You can automate both applications to get the job done.
First, to find mail items that correspond to your conditions you can use the Find
/FindNext
or Restrict
methods of the Items class. You can simply combine all your conditions into a single query string using the logical AND
operator. Read more about these methods in the following articles:
Second, to cope the required information from the message body you can use different properties. The Outlook object model supports three main ways of customizing the message body:
The Body property returns or sets a string representing the clear-text body of the Outlook item.
The HTMLBody property of the MailItem
class returns or sets a string representing the HTML body of the specified item. Setting the HTMLBody
property will always update the Body property immediately. For example:
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties.
Dim objMail As Outlook.MailItem
'Create e-mail item
Set objMail = Application.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Enter the message <a href="http://google.com">text</a> here. </BODY></HTML>"
.Display
End With
End Sub
The Word object model can be used for dealing with message bodies. See Chapter 17: Working with Item Bodies for more information.
From the Word object model you could copy and paste the required information directly to Excel.