Reply in Outlook 2007

I’ve been trying to figure this out but to no avail. What I want to do is when someone emails me I reply back with a “Hi <first name>”. I already have a couple saved responses for reoccurring emails, but I can’t figure out how to automatically pull the persons first name and put it in the email.

You would need a script to build the email for you and have it run anytime new mail arrives. This should create a new message reply for the selected email for you but not sure how to access specific email parts like the name of the sender.

Sub AutoReply()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Reply
objMail.Body = GetReplyToAddress(objMail)
objMail.Display
Set objItem = Nothing
Set objMail = Nothing
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = _
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = _
objApp.ActiveInspector.CurrentItem
Case Else
End Select
End Function

Through up an error when I created a macro. “Compile Error. Sub or Function Not Defined” and it highlights the 5th line

GetReplyToAddress

I just ran this. It will open a auto reply. To send you need to put objMail.Send in there after the objMail.Display unless you dont want it to show up.

Not too familiar with VB script so I wouldn’t know how to access the original mail just went off my VB experience and a generic select script.


Sub AutoReply()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Reply
objMail.Body = "auto reply test"
objMail.Display
Set objItem = Nothing
Set objMail = Nothing
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = _
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = _
objApp.ActiveInspector.CurrentItem
Case Else
End Select
End Function