How to auto create a dear sender’s name when replying message in Outlook?
When replying email message, you should type the sender’s name and greetings manually. To save time and improve work efficiency, you may consider creating a dear sender’s name and greetings automatically in Outlook. This article, I will talk about some useful methods for solving this task in Outlook.
Create a dear sender’s name and greetings automatically when replying message:
To insert the dear sender's name and greetings automatically when replying a message, the Kutools for Outlook's Add greeting when reply feature can help you finish this job quickly and easily in Outlook.
Kutools for Outlook: with more than 20+ handy Excel add-ins, free to try with no limitation in 60 days. Download and try the free trial now!
The following VBA code can help you to auto insert a dear sender’s name and greetings when replying an email message, please do as this:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, double click ThisOutlookSession from the Project1(VbaProject.OTM) pane to open the mode, and then copy and paste the following code into the blank module.
VBA code: Auto insert a dear sender’s name and greetings when replying:
Public WithEvents GExplorer As Outlook.Explorer Public WithEvents GMailItem As Outlook.MailItem Private Sub Application_Startup() Set GExplorer = Outlook.Application.ActiveExplorer End Sub Private Sub GExplorer_SelectionChange() Dim xItem As Object On Error Resume Next Set xItem = GExplorer.Selection.Item(1) If xItem.Class <> olMail Then Exit Sub Set GMailItem = xItem End Sub Private Sub GMailItem_Reply(ByVal Response As Object, Cancel As Boolean) AutoAddGreetingToReply Response End Sub Private Sub GMailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean) AutoAddGreetingToReply Response End Sub Sub AutoAddGreetingToReply(Item As Object) Dim xGreetStr As String Dim xReplyMail As MailItem Dim xSenderName As String Dim xRecipient As Recipient On Error Resume Next If Item.Class <> olMail Then Exit Sub Set xReplyMail = Item For Each xRecipient In xReplyMail.Recipients If xSenderName = "" Then xSenderName = xRecipient.Name Else xSenderName = xSenderName & "," & xRecipient.Name End If Next xRecipient Select Case Time Case 0.3 To 0.5 xGreetStr = " Good morning!" Case 0.5 To 0.75 xGreetStr = " Good afternoon!" Case Else xGreetStr = " Good evening!" End Select With xReplyMail .Display .HTMLBody = "<HTML><Body>Dear " & xSenderName & ",</HTML></Body>" & xGreetStr & .HTMLBody End With End Sub
3. Then close the Outlook and restart it to take the code effect, and now, when you reply an email message, a dear sender’s name and greetings are inserted into the body automatically, see screenshot:
Create a dear sender’s name and greetings automatically when replying message with Kutools for Outlook
If you have Kutools for Outlook, with its Add greeting when reply feature, Outlook will auto insert the sender’s name when replying.
|Kutools for Outlook : with more than 20 handy Outlook add-ins, free to try with no limitation in 60 days.|
After installing Kutools for Outlook, please do as this：
1. Click Kutools > Options, see screenshot:
2. In the Options dialog box, under the Reply tab, check Add greeting when reply option, and then enter the greetings as you need, see screenshot:
3. Then click OK to finish this setting, from now on, when replying a message, the greetings will be created automatically in front of the message body, see screenshot:
Kutools for Outlook
More than 100 Advanced Functions for Outlook 2010, 2013, 2016, 2019 and 365