I would like to set up a worksheet with a schedule of
bills to be paid and be notified a few days in advance, by
email, when the bill is due.
Any takers?
Any Suggestions?
Thanks much.
I would like to set up a worksheet with a schedule of
bills to be paid and be notified a few days in advance, by
email, when the bill is due.
Any takers?
Any Suggestions?
Thanks much.
John,
Here is some code that looks through a worksheet when activated and lists
all items for the next 5 days
Option Explicit
Private Sub Worksheet_Activate()
Dim cLastRow As Long
Dim i As Long
Dim sBody As String
cLastRow = Me.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To cLastRow
If Me.Cells(i, "A").Value > Date ANd _
me.Cells(I,"A").Value < Date + 5 Then
sBody = sBody & Cells(i, "B") & " - " & Format(Cells(i, "A"),
"dd mmm yyyy ") & vbCrLf
End If
Next i
If sBody <> "" Then SendeMail sBody
End Sub
Sub SendeMail(body As String)
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True
Set oMailItem = oOutlook.CreateItem(0)
Set oRecipient = _
oMailItem.Recipients.Add("bob.phillips@somewhere.com")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
With oMailItem
.Subject = "The extract has finished."
.body = body
.Display 'use .Send when all testing done
End With
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"John" <johnpedro@earthlink.net> wrote in message
news:0fdd01c51a19$53188e70$a601280a@phx.gbl...
> I would like to set up a worksheet with a schedule of
> bills to be paid and be notified a few days in advance, by
> email, when the bill is due.
>
> Any takers?
>
> Any Suggestions?
>
> Thanks much.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks