+ Reply to Thread
Results 1 to 2 of 2

Email Notification

  1. #1
    John
    Guest

    Email Notification

    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.

  2. #2
    Bob Phillips
    Guest

    Re: Email Notification

    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("[email protected]")
    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" <[email protected]> wrote in message
    news:[email protected]...
    > 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.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1