Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2013

    Unanswered: Send Email, VBA references

    I am using Access 2000 and Outlook 2007. I am having trouble sending an email from Microsoft Access. The VBA references I am using are:
    Visual Basic For Applications
    Microsoft Access 9.0 Object Library
    OLE Automation
    Microsoft DAO 3.6 Object Library
    Microsoft ActiveX Data Objects 2.1 Library
    Microsoft Forms 2.0 Object Libary
    Microsoft Internet Controls
    Microsoft Office 12.0 Object Library
    Microsoft Outlook 12.0 Object Library
    Microsoft Windows Common Controls-2 6.0 (SP6)
    Microsoft Calendar Control 9.0

    This code works with Microsoft Office 9.0 Object Library, but it is not available in my references options. So, I need to be able to use Microsoft Office 12.0 Object Library. Right now, there is no error message; however, it does not display any emails in Outlook. Thanks for your help.
    Here is my code:
    Private Sub Command190_Click()
    Dim dl1 As Variant
    Dim dl2 As Variant
    Dim string1 As Variant
    Dim myOlApp As Outlook.Application
    Dim MyItem As Outlook.MailItem
    Dim system1, sites1, clients1 As Variant
    Dim date1, date2 As Date
    Dim day1, day2 As String
    Dim dtrf1, dtrf2 As Variant
    On Error GoTo ErrorHandler1
    string1 = Combo188.Value
    dl1 = DLookup("[DistributionLists]", "[DistroLists]", "[Application1] = '" & string1 & "'")
    Set myOlApp = CreateObject("Outlook.Application")
    Set MyItem = myOlApp.CreateItemFromTemplate("G:\HET\CustomerCare\...\1d-Planned Maintenance.oft")
        With MyItem
            .To = dl1
            .DeferredDeliveryTime = [scheduledStartDateTime] - 1 / 24
            .Subject = "Planned Maintenance: " & [optionalTitle]
      .HTMLBody = Replace(.HTMLBody, "optionalTitle", [optionalTitle])
      .HTMLBody = Replace(.HTMLBody, "CategoryKey", [CategoryKey])
    .HTMLBody = Replace(.HTMLBody, "description1", [Description])
    .HTMLBody = Replace(.HTMLBody, "impactStatement", [impactStatement])
    .HTMLBody = Replace(.HTMLBody, "system1", system1)
    .HTMLBody = Replace(.HTMLBody, "sites1", sites1)
    .HTMLBody = Replace(.HTMLBody, "clients1", clients1)
                End With
    Set MyItem = Nothing
    Set myOlApp = Nothing
        Exit Sub
    End Sub

  2. #2
    Join Date
    Mar 2009
    This has been answered in another forum: Send Email, VBA references - Access World Forums


Posting Permissions

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