Hey, i have some code that launches outlook. It used to work, however it now gives me an error along the lines of..
Run-time error '-2147417848 (80010108)'
Automation error
The object invoked has disconnected from its clients.
here is my code
I found a reference from another site to requirement of Reference for Microsoft Office 12.0 Object Library.
In my reference list, I only have Office 11.0 Object Library.
Can someone help me?
Run-time error '-2147417848 (80010108)'
Automation error
The object invoked has disconnected from its clients.
here is my code
Code:
Option Compare Database
Option Explicit
Public Function Distribute(newEmail As Boolean, list As String, rejected As Boolean)
' Determine who gets mailed
'''' What level of notification
'''' What departments
' Extract emails
' Send emails
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(OL)
If Not rejected Then
If newEmail = True Then
DoCmd.OutputTo acOutputReport, "report1", acFormatHTML, "C:\myreport.html" '' seeking approval
Else
DoCmd.OutputTo acOutputReport, "report2", acFormatHTML, "C:\myreport.html" '' approved
End If
Else
DoCmd.OutputTo acOutputReport, "report3", acFormatHTML, "C:\myreport.html" '' rejected
End If
Open "C:\myreport.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.To = list
MyItem.Subject = "Change Management Submission"
MyItem.Display
End Function
In my reference list, I only have Office 11.0 Object Library.
Can someone help me?