Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

myItem.Display

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

End Sub

If you are unfamiliar with VBA see here http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.