+ Reply to Thread
Results 1 to 2 of 2

Macro that sends a formatted email from Excel

  1. #1
    Registered User
    Join Date
    10-17-2014
    Location
    Rio Rancho, NM
    MS-Off Ver
    Office 2013
    Posts
    1

    Question Macro that sends a formatted email from Excel

    I created this macro in Excel below to send emails to the team that the data belongs to. The problem is that the email has to be a specific font and color and has to add my signature.

    This code works, but does not format any text.

    Sub Send_Range()

    ' Select the range of cells on the active worksheet.
    Application.Goto ActiveWorkbook.Sheets("Team").Range("A10:J33")

    'Show the envelope on the ActiveWorkbook.
    ActiveWorkbook.EnvelopeVisible = True

    ' Set the optional introduction field thats adds
    ' some header text to the email body. It also sets
    ' the To and Subject lines. Finally the message
    ' is sent.
    With ActiveSheet.MailEnvelope
    .Introduction = "Good morning, Here are the stats for your team Today, Yesterday and MTD."
    .Item.To = "Team <[email protected]>"
    .Item.Subject = "Today, Yesterday, MTD -Team"
    .Item.Send
    End With
    End Sub

    This is the code that I am working on. I want to add the font color, font, and my signature. I am new to VB and have found all the information that I need from this forum. You guys seem to know it all, so I thought I'd ask for help on finding the correct command to make this email format correctly.

    Sub Send_Range()
    Dim blue, rgbValue As Integer
    ' Return the value for BLUE.
    blue = RGB(0, 150, 214)
    ' Select the range of cells on the active worksheet.
    Application.Goto ActiveWorkbook.Sheets("Team").Range("A13:J48")

    ' Show the envelope on the ActiveWorkbook.
    ActiveWorkbook.EnvelopeVisible = True

    ' Set the optional introduction field thats adds
    ' some header text to the email body. It also sets
    ' the To and Subject lines. Finally the message
    ' is sent.

    With ActiveSheet.MailEnvelope

    .Introduction= "<html><span style='font size:11.0pt;Font Face:Simplified;color:blue'>" & _
    "Good Morning Team,"<p2>"Here are the stats for your team Today, Yesterday and MTD."<p2/><p3>"Regards,"<p3/><p4>"Myname"<p4/><p5>"mytitle"<p5/><br><p6>"mygroup"<p6/><p7><p7/><p8>"[email protected]"<p8/><P9>"Myphonenumber"<P9/><P10>"Company Name"<P10/><P11>"2351 HP Way"<P11/><P12>"Rio Rancho, NM 87124"<P12/><P13>"USA"<P13/><br><br>" & _
    "<html/></span>"
    .Item.To = "TeamTeam <[email protected]>"
    .Item.Subject = "Today, Yesterday, MTD SLA -Team"
    MsgBox .HTMLbody
    .Item.Send
    End With
    End Sub

    Any help would be appreciated.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Macro that sends a formatted email from Excel

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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. macro which sends email to few receipients with a standard message
    By megtoma in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-21-2014, 07:57 AM
  2. HELP! Need help with macro that automatically sends email when...
    By KngCharming in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-28-2013, 01:01 PM
  3. VBS/OutMail script and macro sends email message twice
    By Andrew_Harris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 08:57 PM
  4. Macro that sends email automatically once a week?
    By GTfan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2012, 02:44 PM
  5. A macro that looks up a email from sheet2 and sends email
    By AdderLee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 02:24 PM

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