Results 1 to 2 of 2

Macro to send specific cells to an email as text.

Threaded View

  1. #1
    Registered User
    Join Date
    09-16-2015
    Location
    Places
    MS-Off Ver
    2013
    Posts
    20

    Macro to send specific cells to an email as text.

    Hi all,

    I'm relatively new to VB programming in Excel.

    I was wondering if someone could help me modify the following script to allow me to specify certain cells in an Excel Spreadsheet to output to an email as text or in a graphical format (not as an attachment) and then automatically send that email.

    This would be to automate the sending of specific cells of an Excel Spreadsheet at a certain time each day as an email.

    Dim CDO_Mail As Object
    Dim CDO_Config As Object
    Dim SMTP_Config As Variant
    Dim strSubject as String
    Dim strFrom as String
    Dim strTo as String
    Dim strCc as String
    Dim strBcc as String
    Dim strBody As String
    
    strSubject = "Results from Excel Spreadsheet"
    strFrom = "xxxxxx@xxxxxxxxx.net"
    strTo = "xxxxxx@gmail.com"
    strCc = ""
    strBcc = ""
    strBody = "" & Str(Sheet1.Cells(2, 1))
    Set CDO_Mail = CreateObject("CDO.Message")
    On Error GoTo Error_Handling
    
    Set CDO_Config = CreateObject("CDO.Configuration")
    CDO_Config.Load -1
    
    Set SMTP_Config = CDO_Config.Fields
    
    With SMTP_Config
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.metrocast.net"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Update
    End With
    
    With CDO_Mail
        Set .Configuration = CDO_Config
    End With
    CDO_Mail.Subject = strSubject
    CDO_Mail.From = strFrom
    CDO_Mail.To = strTo
    CDO_Mail.TextBody = strBody
    CDO_Mail.CC = strCc
    CDO_Mail.BCC = strBcc
    CDO_Mail.Send
    
    Error_Handling:
    If Err.Description <> - Then MsgBox Err.Description
    Your assistance is greatly appreciated!
    Last edited by Thelps; 09-16-2015 at 09:21 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 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
  2. Protect, Save and Send email with specific text VBA
    By Mogles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 07:33 AM
  3. Macro to send Email notification to specific people
    By JDGreen17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2014, 09:22 AM
  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. Send email by using macro to specific customer
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 08:45 PM
  6. Replies: 6
    Last Post: 12-02-2011, 02:14 PM
  7. Macro to send an email of specific rows
    By humacdeep in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 10-10-2011, 10:41 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