Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    ny, ny

    Unanswered: sending trigger email in excel

    The user enters a date. If the system date is 10 days before the specified date, i need to trigger an email through excel. I have used docmd.sendobject but it doesnt seem to work. Could some one help me out plz

    Thank you

  2. #2
    Join Date
    Jan 2004
    Aberdeen, Scotland
    How about something like this
    'reference Microsoft Outlook 10.0 Object Library
    Sub SendMail()
        Dim oOutlook As Outlook.Application
        Dim oNamespace As Outlook.NameSpace
        Dim ofolder As Outlook.MAPIFolder
        Dim oMail As Outlook.MailItem
        Dim oRecipient As Outlook.Recipient
        'create object variables
        Set oOutlook = CreateObject("Outlook.Application")
        Set oNamespace = oOutlook.GetNamespace("MAPI")
        Set ofolder = oNamespace.GetDefaultFolder(olFolderInbox)
        Set oMail = oOutlook.CreateItem(olMailItem)
        'set up mail
        With oMail
            Set oRecipient = .Recipients.Add("")
            oRecipient.Type = olTo
            .Body = "This is some text"
            .Subject = "This is the Title"
        End With
        'get rid of object variables
        Set oRecipient = Nothing
        Set oMail = Nothing
        Set ofolder = Nothing
        Set oNamespace = Nothing
        Set oOutlook = Nothing
    End Sub

    this will send a message via outlook

Posting Permissions

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