Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Send mail when deadline expires

Dear excel(lent) users,

I have a worksheet in which I keep action points. These action points can
expire according to the deadline (when today is bigger than the deadline). Is
it possible to use a macro to send me a mail when the deadline becomes
smaller than today (more people are using this file and I want to stay in
touch with the deadlines). I used :

Private Sub Worksheet_Change2(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng3 = Range("I:I")
If Not Intersect(Range("I"), rng3) Is Nothing Then
If Range("I:I").Value < Now() Then SendMail
End If
End If
EndMacro:
End Sub
Sub SendMail()
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strto = "
strcc = ""
strbcc = ""
strsub = "Important message"
strbody = "Hi there" & vbNewLine & vbNewLine & _
"A new deadline has passed"

With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Send
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

What am I doing wrong?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send worksheet by E-Mail AOU Excel Discussion (Misc queries) 2 April 13th 07 10:18 AM
Send e-mail Andrea Excel Discussion (Misc queries) 3 March 25th 07 12:37 PM
using macro to send e-mail bob777 Excel Discussion (Misc queries) 1 November 2nd 05 11:16 PM
help with send mail through excell Maya Excel Worksheet Functions 0 March 16th 05 05:09 PM
send to mail all the context mariagloria Excel Discussion (Misc queries) 1 January 19th 05 03:09 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"