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 with VBA code
Create a dear sender’s name and greetings automatically when replying message with VBA code
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 100 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:
Click to download Kutools for Outlook and free trial now!
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
📨 Email Management: Easily Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
📁 Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
🌟 Interface Magic: 😊More Pretty and Cool Emojis / Boost Your Outlook Productivity with Tabbed Views / Minimize Outlook Instead of Closing ...
👍 One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / 🕘Show Sender's Time Zone ...
👩🏼🤝👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.