Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wondering if this is possible at all? I have emails that come with me having to reply to them with the following message

Hello NAME,

Your request has been completed.

Thank you.

is there a way for me to automate this process with a click of a button? Also is there a way for me to populate the NAME with the senders name? currently the senders name appears in the "From" field as follows LastName, FirstName. I would like to replace the NAME variable of my message to FirstName value.

I'm wondering if this possible with Outlook 2003?

Any help would be greatly appreciated.

Thank you.

share|improve this question

Save a template file with your text. In the code it is saved to C drive and named NamePlaceholder.oft . Change as needed.

Open a request before running the code.

Sub CreateReplyFromTemplate()

Dim currItem  As Outlook.mailItem
Dim currItemReply  As Outlook.mailItem
Dim myItem As Outlook.mailItem

Dim commaPositionRight As Long
Dim Firstname As String

Set currItem = ActiveInspector.currentItem
Set currItemReply = currItem.Reply
Set myItem = Application.CreateItemFromTemplate("C:\NamePlaceholder.oft")

myItem.To = currItemReply.To
commaPositionRight = InStrRev(myItem.To, ",")
Firstname = Right(myItem.To, commaPositionRight)

myItem.Subject = currItem.Subject

' if "RE:" or "FW:" on the request,
'  and the client replies there would be an extra "RE:" or "FW:"
If InStr(myItem.Subject, "RE: ") = 1 Or InStr(myItem.Subject, "FW: ") = 1 Then
    myItem.Subject = Right(myItem.Subject, Len(myItem.Subject) - 4)
End If

myItem.HTMLBody = myItem.HTMLBody & currItemReply.HTMLBody
myItem.HTMLBody = Replace(myItem.HTMLBody, "NAME", Firstname)

currItemReply.Close olDiscard
currItem.Close olDiscard


Set currItemReply = Nothing
Set myItem = Nothing
Set currItem = Nothing

End Sub

If you are unfamiliar with VBA see here

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .