+ Reply to Thread
Results 1 to 3 of 3

Reminder emails after 30 and 60 days.

Hybrid View

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    2

    Reminder emails after 30 and 60 days.

    Hello everyone,

    First time post here! Just found the forum a few days ago. I am very impressed at the gratitude of everyone in helping others solve problems. Here's mine:

    I would like to make a macro that sends seperate emails to managers at 30 and 60 days after a new hire's start date. (See attached worksheet for more detail)

    The problem is that I have no idea how to write VBA. If anyone would be kind enough to look at my worksheet and give me some direction, I will wish good karma upon you and your family forever.

    Thanks for your help!



    30 60 Evaluations.xlsx

  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: Reminder emails after 30 and 60 days.

    Hello meatcat,

    Welcome to the Forum!

    The macro below will check the worksheet hire dates. If today's date is either 30 or 60 days past the hire date and there is no email date for the 30 or 60 day mark, a email will be sent using Outlook. The attached workbook contains the macro shown and a button on the worksheet has been added to run the macro.

    Macro Code
    
    Sub SendEmails()
    
        Dim Cell As Range
        Dim Day30 As Variant
        Dim Day60 As Variant
        Dim Employee As String
        Dim HireDate As Range
        Dim Manager As String
        Dim ManagerEmail As String
        Dim Message As String
        Dim olApp As Object
        Dim Rng As Range
        Dim Wks As Worksheet
        
            Set Wks = ActiveSheet
            Set Rng = Wks.Range("A1").CurrentRegion
                    
            Set olApp = CreateObject("Outlook.Application")
            
                Set Rng = Intersect(Rng.Offset(1, 0), Rng)
                
                For Each Cell In Rng.Columns(5).Cells
                    Set HireDate = Cell.Offset(0, -3)
                    If Now + 30 >= HireDate + 30 And Cell = "" Then
                        Cell = HireDate + 30
                        Manager = HireDate.Offset(0, 1)
                        ManagerEmail = HireDate.Offset(0, 2)
                        Message = "Please conduct your 30 day review for " & HireDate.Offset(0, -1) & "."
                            With olApp.CreateItem(0)
                                .To = ManagerEmail
                                .Subject = "30 Day Review"
                                .Body = "Dear " & Manager & "," & vbCrLf & vbCrLf & Message
                                .Send
                            End With
                    End If
                Next Cell
                    
                For Each Cell In Rng.Columns(6).Cells
                    Set HireDate = Cell.Offset(0, -4)
                    If Now + 60 >= HireDate + 60 And Cell = "" Then
                        Cell = HireDate + 60
                        Manager = HireDate.Offset(0, 1)
                        ManagerEmail = HireDate.Offset(0, 2)
                        Message = "Please conduct your 60 day review for " & HireDate.Offset(0, -1) & "."
                            With olApp.CreateItem(0)
                                .To = ManagerEmail
                                .Subject = "60 Day Review"
                                .Body = "Dear " & Manager & "," & vbCrLf & vbCrLf & Message
                                .Send
                            End With
                    End If
                Next Cell
            
    End Sub
    Attached Files Attached Files
    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
    06-06-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Reminder emails after 30 and 60 days.

    Hello Leith,

    Thank you so much for your work on this.

    I have noticed that the emails are instantly sending when I click the button without regard to start date. After I click the button, is there a way for the macro to send the email 30 days after the start date and then another one after 60 days? I would like the emails to send on the date populated.

    Is there an easy way to remove the warning that requires the user to click allow?

    I am sorry for the hassle, Leith! Thanks again.

+ 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