+ Reply to Thread
Results 1 to 2 of 2

send email automatically when cells are filled-in

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-10-2013
    Location
    Veendam
    MS-Off Ver
    Excel 2007
    Posts
    100

    send email automatically when cells are filled-in

    Hi All,

    Is it possible if cells A1, A2 and A3 of sheet 1 filled that the code below runs automatically?

    Sub Mail_small_Text_Outlook()
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        strbody = "Hi there" & vbNewLine & vbNewLine & _
                  "This is line 1" & vbNewLine & _
                  "This is line 2" & vbNewLine & _
                  "This is line 3" & vbNewLine & _
                  "This is line 4"
    
        On Error Resume Next
        With OutMail
            .To = "test@test.nl"
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .Body = strbody
            'You can add a file like this
            '.Attachments.Add ("C:\test.txt")
            .Send   'or use .Display
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub
    thank you very much for the comments.

    Greetings,

    Danielle

  2. #2
    Forum Contributor
    Join Date
    07-10-2013
    Location
    Veendam
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: send email automatically when cells are filled-in

    Hi All,

    I use now this code:

    Private Sub Worksheet_Change(ByVal Target As Range)
      On Error Resume Next
      If Intersect(Target, Range("A3")) Is Nothing Then Exit Sub
      If Target = "" Then Exit Sub
    
    ' macro code
    It works fine

    Greetings,

    Danielle

+ 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. Send email automatically before due date
    By Kara_xy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2013, 06:11 AM
  2. Need help with getting excel to automatically send out email....
    By glynjara in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 06:57 PM
  3. Email will not automatically send
    By cgduck21 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-11-2013, 03:22 PM
  4. [SOLVED] Automatic email to automatically send; how?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2012, 04:55 PM
  5. Replies: 6
    Last Post: 12-10-2011, 03:14 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