+ Reply to Thread
Results 1 to 4 of 4

VBA Personalize Outlook Email

  1. #1
    Registered User
    Join Date
    11-25-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    2

    VBA Personalize Outlook Email

    Hi everyone!

    I am trying to customize the body of an email blast. Ideally I would like to email to have "Dear ____" with each one specific to the client. I am able to get the text in however I would like to use HTML to format the font size, color, etc.

    -----------------------------------------------------------------------------------------------------------
    Sub emailreporting()

    Dim emailaddy As String
    Dim emailcc As String
    Dim acctname As String
    Dim acctno As String
    Dim EmailSubject As String
    Dim dateday As String
    Dim datemonth As String
    Dim dateyear As String
    Dim verifyday As String
    Dim resp As String
    Dim resptype As String
    Dim Dear As String


    Cells.Find(What:="Email Subject").Activate
    EmailSubject = ActiveCell.Offset(0, 1).Value
    resptype = ActiveCell.Offset(1, 1).Value
    Cells.Find(What:=resptype & "Dear", SearchOrder:=xlByColumns).Activate
    ActiveCell.Offset(1, 0).Select


    Do

    acctname = ActiveCell.Offset(0, -1).Value
    acctno = ActiveCell.Value
    emailaddy = ActiveCell.Offset(0, 1).Value
    emailcc = ActiveCell.Offset(0, 2).Value
    Dear = ActiveCell.Offset(0, 0).Value

    Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range

    Application.ScreenUpdating = False
    Set OutApp = CreateObject("Outlook.Application")

    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .To = emailaddy
    .cc = emailcc
    .Subject = EmailSubject
    .HTMLBody = Dear & "<p style='color:rgb(0,0,0);font-family:arial;font-size:12'>

    -----------------------------------------------------------------------------------------------------------

    You see how String Dear is used at the beginning of .HTMLBody. How can I move the string Dear into the html coding so that it will have the same font color, size, etc. applied. currently it is outside of the HTML style script. or if there is an alternate way to get the "Dear ___", formatted to the same was as the rest of the email body.

    thanks!!!!

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: VBA Personalize Outlook Email

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-25-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: VBA Personalize Outlook Email

    Thanks PJ!

    I tried putting in your code but it just came out with 'Dear' no longer referencing the string and text only. Any other alternative you can think of?

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: VBA Personalize Outlook Email

    Im not sure if Im missing something, as far as I can see you simply need move the formatting string to the start of the .HTMLBody and then follow with whatever data you were already using.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  2. [SOLVED] Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.
    By Tazyote in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2013, 01:18 PM
  3. send selected range in email with default outlook email signature included
    By mdsickler in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2013, 10:50 PM
  4. How to parse data in Outlook email using HTML version of email back to excel
    By bnasty in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-31-2012, 02:54 PM
  5. Personalize folders
    By César G. in forum Excel General
    Replies: 2
    Last Post: 04-05-2006, 11:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1