forums1167
New member
- Local time
- Today, 03:19
- Joined
- Jun 21, 2013
- Messages
- 3
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:
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:
Code:
[SIZE=2]Private Sub Command190_Click()[/SIZE]
[SIZE=2]Dim dl1 As Variant[/SIZE]
[SIZE=2]Dim dl2 As Variant[/SIZE]
[SIZE=2]Dim string1 As Variant[/SIZE]
[SIZE=2]Dim myOlApp As Outlook.Application[/SIZE]
[SIZE=2]Dim MyItem As Outlook.MailItem[/SIZE]
[SIZE=2]Dim system1, sites1, clients1 As Variant[/SIZE]
[SIZE=2]Dim date1, date2 As Date[/SIZE]
[SIZE=2]Dim day1, day2 As String[/SIZE]
[SIZE=2]Dim dtrf1, dtrf2 As Variant[/SIZE]
[SIZE=2]On Error GoTo ErrorHandler1[/SIZE]
[SIZE=2]string1 = Combo188.Value[/SIZE]
[SIZE=2]dl1 = DLookup("[DistributionLists]", "[DistroLists]", "[Application1] = '" & string1 & "'")[/SIZE]
[SIZE=2]Set myOlApp = CreateObject("Outlook.Application")[/SIZE]
[SIZE=2]Set MyItem = myOlApp.CreateItemFromTemplate("G:\HET\CustomerCare\...\1d-Planned Maintenance.oft")[/SIZE]
[SIZE=2]With MyItem[/SIZE]
[SIZE=2].To = dl1[/SIZE]
[SIZE=2].DeferredDeliveryTime = [scheduledStartDateTime] - 1 / 24[/SIZE]
[SIZE=2].Subject = "Planned Maintenance: " & [optionalTitle][/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "optionalTitle", [optionalTitle])[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "CategoryKey", [CategoryKey])[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "description1", [Description])[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "impactStatement", [impactStatement])[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "system1", system1)[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "sites1", sites1)[/SIZE]
[SIZE=2].HTMLBody = Replace(.HTMLBody, "clients1", clients1)[/SIZE]
[SIZE=2].Display[/SIZE]
[SIZE=2]End With[/SIZE]
[SIZE=2]Set MyItem = Nothing[/SIZE]
[SIZE=2]Set myOlApp = Nothing[/SIZE]
[SIZE=2]ErrorHandler1:[/SIZE]
[SIZE=2]Exit Sub[/SIZE]
[SIZE=2]End Sub[/SIZE]