+ Reply to Thread
Results 1 to 6 of 6

Email notification

Hybrid View

Kid_k Email notification 08-30-2011, 07:54 PM
Leith Ross Re: Email notification 08-30-2011, 08:33 PM
Kid_k Re: Email notification 08-30-2011, 11:03 PM
Leith Ross Re: Email notification 08-30-2011, 11:05 PM
Kid_k Re: Email notification 08-30-2011, 11:10 PM
Leith Ross Re: Email notification 08-31-2011, 02:03 AM
  1. #1
    Registered User
    Join Date
    07-20-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Email notification

    Hi there i have been working on a program that Leith Ross had originally written that emails me when a certain date has passed.
    It is working correctly whoever i am wanting to add a cell that gives me the date it was sent so i know an alert has already been made.
    I am also trying to have the body of the email add a cell value that the client's name is in so that it will say something like "The repair for [Don O] is due please check spreadsheet"
    So for example it takes cell C15 and inserts it into the msg body.

    If anyone can help it would be great. I am not sure where ti start to be honest.
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Email notification

    Hello Kid_K,

    Here is the update macro. This will insert the person's name from column "C" into the message body.
    Sub SendEmailNotices()
    
      Dim Cell As Range
      Dim DateRng As Range
      Dim Msg As String
      Dim olApp As Object
      Dim olEmail As Object
      Dim Person As String
      Dim RngEnd As Range
      Dim Wks As Worksheet
      
        Set Wks = Worksheets("Sheet2")
        
        Set DateRng = Wks.Range("A11").Resize(ColumnSize:=10)
        Set RngEnd = Wks.Cells(Rows.Count, DateRng.Column).End(xlUp)
        Set DateRng = IIf(RngEnd.Row < DateRng.Row, DateRng, Wks.Range(DateRng, RngEnd))
        
       'Change this to what you want.
        Msg = "The repair for " & Person & " is due please check spreadsheet"
        
          For Each Cell In DateRng.Columns(6).Cells
            If Cell >= Int(Now() + 7) And Cell.Offset(0, 8) = "" Then
               Person = Cell.Offset(0, -3)
               If olApp Is Nothing Then Set olApp = CreateObject("Outlook.Application")
               Set olEmail = olApp.CreateItem(0)
                 With olEmail
                   .To = "reception@borgdental.com.au"
                   .Subject = "Expiration notice"
                   .Body = Msg
                   .Send
                 End With
               Cell.Offset(0, 8) = Now()
            End If
          Next Cell
          
        Set olApp = Nothing
        
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-20-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Email notification

    Thank you for this,

    It has been a big help.

    You rock!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Email notification

    Hello Kid_K,

    Glad to know everything is working well for you. Can this post be marked solved?

  5. #5
    Registered User
    Join Date
    07-20-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Email notification

    Yes just about i am trying to do another test run however i am not getting an emails sent but am receiving no errors. is it because the program is aware of the dates?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Email notification

    Hello Kid_K,

    If there is a date in column "N" then the email will not be sent. After the email is sent, the current date and time is recorded in column "N" for that person. Tot test the emails you will need to clear the cells in column "N".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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