Solved

Adding First Name of Recipient for Reply/Reply All in Outlook 2010

Posted on 2013-01-18
1
2,245 Views
Last Modified: 2013-01-23
Is there a simple VBA code that can be used to always put the "First Name" of the person in the body of a email when replying?

i.e ... a line at the top of the new message that was simply [First Name],

I support a helpdesk and this would save me a tremendous amount of time. I would be okay if it was a reply all scenario and there was more than one name if it just defaulted to the first person in the From field in the original message.  I assume it would leverage the info from the profile in the Global Address Book for my company.

I want it to execute anytime I reply or reply all to any message.

Let me know how complex this might be.

Thanks

Adam
0
Comment
Question by:aehrenwo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
R_Edwards earned 200 total points
ID: 38792687
#All credit goes to Lars Vogel#

I had the same question a while back and found this one night after killing my brain.

if you know how to create Macro's in Outlook this will be easy for you, if not i recommend visiting Lars' website http://www.vogella.com/articles/MicrosoftOutlookMacros/article.html

From Lars Vogul Blog:

The following macro describes how you can extract information from the email and create a corresponding message in your email text. For example if you are writting to Jim.Test@example.com you can create a text in your email "Hi Jim,....Best regards, Lars" and place the cursor in the right place to start typing.

The following macro reads all email addresses in the To part of the email. Then is extracts the part before the first "." assumes that this is the first name and writes Hello firstname1, firstname2,...

It also puts in "Best regards, Lars" and places the cursor on the right position to reply. The macro allows also to set a defined delay in sending out the email.

Sub Generic(greeting, byebye, myname, includeCC, category, delay, text)
   
    Dim olApp As Outlook.Application
   
    Set olApp = Outlook.Application

    If TypeName(Application.ActiveInspector.CurrentItem) = "MailItem" Then
        Call mailreply(greeting, byebye, myname, includeCC, category, delay, text)
    End If
   
End Sub


Sub mailreply(greeting, byebye, myname, includeCC, category, delay, text)
   
    Dim objMail As Outlook.MailItem
   
    Set objMail = Application.ActiveInspector.CurrentItem
   
    With objMail
       'Set body format to HTML
       Dim arry As String
       Dim help As String
       
       Dim email, vorname As Variant
 
       
       Dim cced As Variant
       Dim anrede As Variant
       Dim size As Integer
       
       cced = Split(.CC, ";")

       
       email = Split(.To, ";")
       Dim Anzahl As Integer
       
       ' Now get the names of the persons which are in the email
       
       Anzahl = UBound(email)
       
        first = True
        For I = 0 To Anzahl
       
            'If Not email(i) = "Vogel, Lars;" Then
           
             vorname = Split(email(I), ",")
             
           'If size(vorname()) <> 0 Then
             
            If UBound(vorname) > 0 Then
            If first Then
            anrede = vorname(1)
            first = False
            Else
            anrede = anrede & " / " & vorname(1)
        End If

        End If
       ' End If
       
       
       
       Next I
       
       If includeCC = "1" Then
       
       ' Now get the names of the persons which are cc'ed
       
       Anzahl = UBound(cced)
       
        first = True
       For I = 0 To Anzahl
       If Not email(I) = "Vogel, Lars" Then
        vorname = Split(cced(I), ",")
       
        If UBound(vorname) > 0 Then
        If first Then
        anrede = anrede & " ," & vbNewLine & "cc:" & vorname(1)
        first = False
       
         Else
        anrede = anrede & " / " & vorname(1)
        End If

        End If
        End If
       
       Next I
       
        Else
             anrede = anrede & " ,"
        End If
       
       .Body = greeting & anrede & vbNewLine & vbNewLine & text & vbNewLine & vbNewLine & byebye & myname & vbNewLine & vbNewLine & "---------------------------------------" & vbNewLine & .Body
       
       .Display
       
       
    End With
    objMail.Categories = category
       
    'End If
    SendKeys "{DOWN}"
    SendKeys "{DOWN}"
   
End Sub

Sub Reply_Text_English_Urgent()
    Call Generic("Hi", "Best regards, ", "Lars", 0, "Business", False, "")
End Sub


Again this is not my work and all credit goes to lars Vogul.

hope this helps
-=Richard
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read this checklist to learn more about the 15 things you should never include in an email signature.
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question