send auto email work anniversary

kerm007

Active Member
Joined
Mar 16, 2019
Messages
250
Office Version
  1. 365
Platform
  1. Windows
hello
how can my HR girls auto send email to all when its the work anniversary of some one from an excel sheet populated with the name and the anniversay date of an employee ?
Thanks
 
how did you do the text in C1/2 cannot get it they way you set it
:)
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
i also get invalid name error in D4
:(
OK. I assumed that since you only mentioned the formula for E4 that the formula in D4 was working as intended.

In that case, it seems the issue is with the named range nrToday. You can change the formula to avoid that by using these formulas which reference the cell directly without using a named range.

D4
Excel Formula:
=IF(AND(MONTH(B4)=MONTH($B$1),DAY(B4)=DAY($B$1)),"Anniversary","")

E4
Excel Formula:
=DATEDIF([@Hired],$B$1,"Y")

As long as that's where your date is stored, that should allow
 
Upvote 0
hello
i assume i have to replace someting on this line ?
For Each rngCell In Range("tblX[Name]")

Thanks
 
Upvote 0
ok no more error but when i open there error in : For Each rngCell In Range("tblX[Name]")

Ty
 
Upvote 0
hello
i assume i have to replace someting on this line ?
For Each rngCell In Range("tblX[Name]")

Thanks
Not if you've properly named the table (tblX) and Cell A3 = "Name"
 
Upvote 0
Cell A3 Yes but the table ????
not sure i did it right
 

Attachments

  • Screenshot 2023-06-15 145806.png
    Screenshot 2023-06-15 145806.png
    27.9 KB · Views: 3
Upvote 0
ok i found it one thing is instead of saying
Congratulations, yo! can we get the name of the person and instead of the employee mail i will replace it with the global all emplyoee group mail :)
 
Upvote 0
ok i found it one thing is instead of saying
Congratulations, yo! can we get the name of the person and instead of the employee mail i will replace it with the global all emplyoee group mail :)
VBA Code:
Private Sub Workbook_Open()

Dim rngCell     As Range
Dim lngSpace    As Long
Dim strMessage  As String
Dim strName     As String

Const STRRECIPIENTS _
As String = "Your.Employees@WhereverYou.Work"

For Each rngCell In Range("tblX[Name]")

  If rngCell.Offset(0, 3) = "Anniversary" Then

    lngSpace = VBA.InStr(rngCell.Text, " ") - 1
    strName = VBA.Left(rngCell.Text, lngSpace)

    strMessage = "Congratulations to " & strName & _
      ".<br><br>We are so absolutely gobsmacked to have " & _
      "them working with us.<br><br>Happy " & _
      Addth(rngCell.Offset(0, 4).Value) & _
      " Work Anniversary, " & strName & "!"

    Call Email _
      (STRRECIPIENTS, "Let's Celebrate!", strMessage)

    strMessage = ""

  End If

Next rngCell

End Sub
 
Upvote 0
Hello
where i put the mail of employee should i replace it ?
 
Upvote 0

Forum statistics

Threads
1,215,183
Messages
6,123,522
Members
449,103
Latest member
Michele317

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top