# Reply in Outlook 2007

**URL:** <https://forums.speedlife.net/t/reply-in-outlook-2007/207477>\
**Category:** NYSpeed Off Topic\
**Created:** [December 22, 2010, 5:59am UTC](https://forums.speedlife.net/t/reply-in-outlook-2007/207477 "2010-12-22T05:59:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ProgRocker](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/progrocker/32/5434_2.png) [@ProgRocker](https://forums.speedlife.net/u/ProgRocker)\
**Post date:** [December 22, 2010, 5:59am UTC](https://forums.speedlife.net/t/reply-in-outlook-2007/207477/1 "2010-12-22T05:59:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![boxxa](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/boxxa/32/5045_2.png) [@boxxa](https://forums.speedlife.net/u/boxxa)\
**Post date:** [December 22, 2010, 11:47am UTC](https://forums.speedlife.net/t/reply-in-outlook-2007/207477/2 "2010-12-22T11:47:23Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ProgRocker](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/progrocker/32/5434_2.png) [@ProgRocker](https://forums.speedlife.net/u/ProgRocker)\
**Post date:** [December 22, 2010, 11:55am UTC](https://forums.speedlife.net/t/reply-in-outlook-2007/207477/3 "2010-12-22T11:55:26Z")

</div>

> [@boxxa](#):
>
> 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.
> 
> ```auto
> 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

```auto
GetReplyToAddress

```

---

<div class="post-metadata">

**Author:** ![boxxa](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/boxxa/32/5045_2.png) [@boxxa](https://forums.speedlife.net/u/boxxa)\
**Post date:** [December 22, 2010, 12:18pm UTC](https://forums.speedlife.net/t/reply-in-outlook-2007/207477/4 "2010-12-22T12:18:08Z")

</div>

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.

```auto

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

```
