+ Reply to Thread
Results 1 to 2 of 2

How to: Send email which include specific cells in red colour?

Hybrid View

  1. #1
    Registered User
    Join Date
    12-05-2016
    Location
    Bulgaria
    MS-Off Ver
    2010
    Posts
    26

    How to: Send email which include specific cells in red colour?

    Hello to all,
    I have one worksheet with data. How it is possible to click on a button and send all cells in red via email?
    Example: There are 100 companies with overdue invoices, which invoices I marked in red colour. I do not need to send the all worsheet, I need to send only the invoices marked in red colour.
    P.S I need something like in this tutorial, but the cells should be only these with red colour.
    https://www.extendoffice.com/documents/excel/1354-excel-send-range-as-email.html#a2
    Thanks in advance!
    Last edited by ton4ito; 04-02-2017 at 08:05 AM.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to: Send email which include specific cells in red colour?

    hi
    a couple of questions
    • do you want to send a separate email to all the cells in red, or a single email containing the content of all the cells in red?
    • if the former, where are the email addresses stored?

    otherwise, the macro below will copy the content of every red cell into a text string and send it to the named recipient.

    note that a lot of colours could be considered "red". the macro assumes the cell is pure red, i.e. RGB (255,0,0). If you are using a different shade of red, you will need to tweak the macro.




    Sub RedCellsEmail()
    Dim CCell As Range, txt As String, MyApp As Outlook.Application, MyMail As Outlook.MailItem
    Set MyApp = CreateObject("outlook.Application")
    Set MyMail = MyApp.CreateItem(olMailItem)
    
    txt = ""
    
    For Each CCell In ActiveSheet.UsedRange.Cells
        If CCell.Interior.Color = RGB(255, 0, 0) Then
            txt = txt & CCell & Chr(10)
        End If
    Next CCell
    
    With MyMail
        .To = "someone@somewhere.com"
        .cc = ""
        .BCC = ""
        .Subject = "this is the subject"
        .Body = txt
        .Display 'or use .send
    End With
    
    Set MyMail = Nothing
    Set MyApp = Nothing
    
    End Sub
    p.s. you will need to have the Outlook object library selected under tools > references in the VBA area for this to work
    Last edited by NickyC; 04-02-2017 at 09:30 PM. Reason: add p.s.

+ 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 to send specific cells to an email as text.
    By Thelps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2015, 09:02 PM
  2. Send email when 2 cells contains specific text.
    By jurgen010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2015, 04:54 PM
  3. Only want button to send email when its a certain colour
    By Muzza86 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2014, 08:43 PM
  4. Send Email with Specific Text from Cells in the body
    By Will03 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2013, 12:30 PM
  5. auto send email with cell background colour
    By vipulhumein in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2013, 03:25 PM
  6. Automatically send an email from excel with specific data on specific date.
    By Angela1607 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2009, 08:11 AM
  7. Send data from Excel in email from specific email account
    By eriknokc in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-05-2007, 05:02 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