Your email is clear but lacks detail, such as where the email is. Yes, in the body, but that doesn't really help, as such I've created a demo mock up which should be easy enough to follow :
Let's assume the email I receive is in the following format:
Dear Sir,
We received the following detail
Email: myEmail@domain Phone: 12345
We will be in touch
Signed off
The following VBa code will find the email address, and open a new email with this address in the To field
Sub MailItemContent2()
Dim olItem As Outlook.MailItem
Dim sText As String
Dim sEmail As String
Dim emailWords() As String
Set olItem = ActiveExplorer.Selection.Item(1)
sText = Replace(olItem.Body, vbCrLf, " ")
emailWords = Split(sText, " ")
Dim i As Integer
Dim emailIndex As Integer
emailIndex = -99
isNext = False
For i = 0 To UBound(emailWords)
If (emailIndex = i) Then
sEmail = Split(emailWords(i), Chr(34))(2)
Exit For
End If
If emailWords(i) = "Email:" Then
emailIndex = i + 2
End If
Next i
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.To = sEmail
'.CC = "name@domain.com"
'.BCC = "name@domain.com"
'.Subject = "The subject"
'.Categories = "Test"
'.VotingOptions = "Yes;No;Maybe;"
'.BodyFormat = olFormatPlain
'.Importance = olImportanceHigh
'.Sensitivity = olConfidential
.Display
End With
Set objMsg = Nothing
End Sub
Hi, yes the emails are actually set out just like that. Thank you for taking the time to answer my questions - that has been really helpful, thanks Sarah – SarahB – 2015-05-05T09:16:34.350
Then feel to upvote or mark as answer @SarahB – MyDaftQuestions – 2015-05-05T09:28:24.443