Results 1 to 14 of 14

Macro, Auto, Email, Date

Threaded View

  1. #1
    Registered User
    Join Date
    02-12-2018
    Location
    FOUNTAIN, COLORADO
    MS-Off Ver
    OFFICE 365
    Posts
    8

    Macro, Auto, Email, Date

    Using Excel Office 365. This is the Module. I'm sure it is something very simple but it is driving me crazy. It sends the email perfectly when I hit "run" from Developer, Macros. I need it to run when the Workbook opens. This code is in a module for "Sheet 16". The dates are in the two columns. Thanks for your help.

    Option Explicit
    
    Sub email()
    
        Dim r As Range
        Dim cell As Range
    
        Set r = Range("D3:D300", ["G3:G200"])
        For Each cell In r
    
            If cell.Value = Date Then
    
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        strbody = "SOW OUT - SOW NEW D & G"
        On Error Resume Next
        With OutMail
            .To = "gaias@comcast.net"
            .CC = "online2007@comcast.net"
            .BCC = ""
            .Subject = "ALERT"
            .Body = strbody
            .Send
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
    End If
    
    Next
    
        Exit Sub
    
    debugs:
            If Err.Description <> "" Then MsgBox Err.Description
    
    End Sub
    Last edited by MARILYNMING; 02-13-2018 at 03:17 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Generating Email to Remind on Due Date
    By cyee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2015, 08:57 PM
  2. Macro/VBA to Auto Refresh + Auto Email
    By grosh83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2014, 09:05 PM
  3. VBA to run auto email code when date becomes yesterday
    By kdean571 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2014, 06:33 PM
  4. Auto-email after 30 days of specified date for multiple items
    By Brandon123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2014, 12:23 PM
  5. Check date, auto email
    By JonathanB2 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-12-2013, 11:17 AM
  6. auto email date coming due
    By bfredricksen in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-18-2013, 11:46 AM
  7. [SOLVED] Can Excel auto-send an email on a given date?
    By dannykray_z in forum Excel General
    Replies: 1
    Last Post: 04-18-2006, 02:43 PM

Tags for this Thread

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