shopaholic
New Member
- Joined
- Oct 19, 2013
- Messages
- 10
Hi,
I followed the solution provided by Jim May in this thread http://www.mrexcel.com/forum/excel-...atic-birthday-wishes-using-excel-outlook.html and it worked perfectly.
However, I have a few more requirements -
I wanted to embed an image below the birthday wishes text.
Solution- I added CC BCC code and then used htmlBody to change font color, size, etc. it is working good.
Now -
1) I want to automate this email sending - I read about CDO but don't know how to go about it.
2) How can I make this vba independent of system state? (I know already this is next to impossible, can it run even if system is not ON?)
3) I want to make it send birthday wishes to people who have their birthday on weekends and holidays also.
I'm focusing on understanding CDO meanwhile expect some help.
Thanks.
I followed the solution provided by Jim May in this thread http://www.mrexcel.com/forum/excel-...atic-birthday-wishes-using-excel-outlook.html and it worked perfectly.
Code:
[COLOR=#333333]Sub DoBirthdayRoutine()[/COLOR]
Dim olApp As Outlook.ApplicationDim MItem As Outlook.MailItemDim cell As RangeDim Subj As StringDim EmailAddr As StringDim Msg As StringSet olApp = New Outlook.ApplicationApplication.ScreenUpdating = FalseSheets("Sheet1").ActivateLR = Range("B" & Rows.Count).End(xlUp).RowFor Each cell In Range("B2:B" & LR) If Month(cell) = Month(Date) And Day(cell) = Day(Date) Then Pos = WorksheetFunction.Find(" ", cell.Offset(, -1)) FName = Left(cell.Offset(, -1), Pos - 1) Subj = "Happy B'day" EmailAddr = cell.Offset(, 1).Value Msg = "Dear " & FName & "," & vbNewLine Msg = Msg & vbNewLine & " Happy Birthday to you and many more happy returns. Have a wonderful day." & vbCrLf & vbCrLf Set MItem = olApp.CreateItem(olMailItem)With MItem .To = EmailAddr .Subject = Subj .Body = Msg .SendEnd WithEnd IfNextApplication.ScreenUpdating = True [COLOR=#333333]End Sub
[/COLOR]
However, I have a few more requirements -
I wanted to embed an image below the birthday wishes text.
Solution- I added CC BCC code and then used htmlBody to change font color, size, etc. it is working good.
Now -
1) I want to automate this email sending - I read about CDO but don't know how to go about it.
2) How can I make this vba independent of system state? (I know already this is next to impossible, can it run even if system is not ON?)
3) I want to make it send birthday wishes to people who have their birthday on weekends and holidays also.
I'm focusing on understanding CDO meanwhile expect some help.
Thanks.