Sub bdaymessages()

Dim I, K As Long


    Dim olApp As Outlook.Application
    Dim olMail As MailItem

    Dim SigString As String
    Dim Signature As String


    Application.ScreenUpdating = False


    Set olApp = New Outlook.Application

'it is counting the non blank cells in col a

 K = Application.WorksheetFunction.
CountA(Sheets("Sheet1").Range("a:a"))

For I = 2 To K


 If Day(Now) = Day(CDate(Range("c" & I).Value)) And Month(Now) =
Month(CDate(Range("c" & I).Value)) Then

 Set olMail = olApp.CreateItem(olMailItem)
    With olMail
        .To = ActiveSheet.Range("b" & I).Text
        .Subject = "Happy Birthday Dear " & Range("a" & I).Text
        .Body = "Dear  " & ActiveSheet.Range("a" & I).Text & vbCrLf & vbCrLf
& "  birthday  message " & vbCrLf & ActiveSheet.Range("e" & I).Text
        .Display
        '.Send

    End With

    Set olMail = Nothing

End If


 If (Year(Now) - Year(CDate(Range("D" & I).Value))) Mod 5 = 0 Then


 Set olMail = olApp.CreateItem(olMailItem)
    With olMail
        .To = ActiveSheet.Range("b" & I).Text
        .Subject = "Congratulations on  completion of " & Year(Now) -
Year(CDate(Range("D" & I).Value)) & " years of service"
        .Body = "Dear  " & ActiveSheet.Range("a" & I).Text & vbCrLf & vbCrLf
& "  Congrats  message " & vbCrLf & ActiveSheet.Range("e" & I).Text
        .Display
        '.send
    End With

    Set olMail = Nothing

End If


> Regards
> Ashish koul
> http://akoul.blogspot.com/
>
>
>
> On Sat, Aug 21, 2010 at 10:31 AM, Chandra Gupt Kumar <
> kumar.bemlmum...@gmail.com> wrote:
>
>>  Could you please share how it is possible.
>>
>>
>>
>>
>>
>>
>>
>> Regards,
>>
>>
>>
>> C.G.Kumar
>>
>>
>>
>>
>>
>> *From:* excel-macros@googlegroups.com [mailto:
>> excel-mac...@googlegroups.com] *On Behalf Of *Vasant
>> *Sent:* Friday, August 20, 2010 1:43 PM
>> *To:* excel-macros@googlegroups.com
>> *Subject:* Re: $$Excel-Macros$$ sending e mail based on data in column in
>> excel
>>
>>
>>
>> Yes, it is possible to do
>>
>>
>>
>> Regards
>>
>> Vasant
>>
>>
>>
>>
>>
>>
>>
>> On 8/20/10, *Chandra Gupt Kumar* <kumar.bemlmum...@gmail.com> wrote:
>>
>> Dear All,
>>
>>
>>
>> My requirements are as follows;
>>
>>
>>
>> 1.       Based on date of birth (Col D), mail to be sent on particular
>> day to respective office for good wishes.
>>
>> 2.       Based on date of joining , congratulation mail to be sent if the
>> concerned completes 5,10,15,20,25,35,40 years of service.
>>
>>
>>
>> It is possible to do so ?
>>
>>
>>
>> Regards,
>>
>>
>>
>> C.G.Kumar
>>
>>
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> HELP US GROW !!
>>
>> We reach over 7000 subscribers worldwide and receive many nice notes about
>> the learning and support from the group.Let friends and co-workers know they
>> can subscribe to group at
>> http://groups.google.com/group/excel-macros/subscribe
>>
>>
>>
>>
>> --
>> Regards
>>
>> Vasant
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> HELP US GROW !!
>>
>> We reach over 7000 subscribers worldwide and receive many nice notes about
>> the learning and support from the group.Let friends and co-workers know they
>> can subscribe to group at
>> http://groups.google.com/group/excel-macros/subscribe
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> HELP US GROW !!
>>
>> We reach over 7000 subscribers worldwide and receive many nice notes about
>> the learning and support from the group.Let friends and co-workers know they
>> can subscribe to group at
>> http://groups.google.com/group/excel-macros/subscribe
>>
>
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to