Hi Everyone,
I am trying to write a macro to send mail on every Friday and also on last day of every month. If the last day of the month falls on Saturday or Sunday then the macro should mail on Friday. I have written a separate macro to send a mail. I have also written to check day(ie Monday, Tuesday etc) of today. If today is Friday or month end i can send mail. I dont know how to tell the macro to send mail on friday if the month last date is saturday or sunday. Is the below code is ok or i have add something ?. Please help me. I am now only starting to learn macro.
Sub done()
Dim Dat As Date, x As Integer, y As Date, sorry As String
Dim str As String
sorry = "Today is not friday or month end. So i cannot send mails"
str = WeekdayName(Weekday(Now()))
Dat = Date
x = Month(Dat)
y = Application.WorksheetFunction.EoMonth(Dat, x)
If (str = friday) Or (Date = y) Then
Send mail - Here i can include the mail part
Else
MsgBox sorry
End Sub
Bookmarks