Take the 2-minute tour ×

I have text data that I read from a file; I need to place it in the body of an email message. There are about 50 such data items to be placed into existing text.

It seems I should be able to put a marker (dataItem1, dataItem2, etc.) and replace that with the matching text data from the file.

Searches only turn up replacing field data such as Recipient, Subject, etc., or replacing the entire body. Would I have to generate the entire body in the code? Seems like I should be able to "insert" a data item into existing body text.

Any suggestions will be much appreciated.

share|improve this question
add comment

1 Answer

Use the Body property of the MailItem you're working with. Assign it to a variable and you can edit it:

Dim body As String

body = myMessage.Body
body = Replace(body,"dataItem1","your replacement here")

Then assign the variable to the Body:

myMessage.Body = body
share|improve this answer
add comment

Your Answer


