G
Guest
I am trying to send an email with attachment from Access 2007. The following
code fails to detect Outlook even though it is open, or even try to create a
new instance.
Dim objApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim blnOutlookInitiallyOpen As Boolean
Dim strProcName As String
On Error Resume Next
strProcName = "SendOutlookMessage"
blnOutlookInitiallyOpen = True
Set objApp = GetObject(, "Outlook.Application")
If objApp Is Nothing Then
Set objApp = CreateObject("Outlook.Application")
'* Outlook wasn't open when this function started.
blnOutlookInitiallyOpen = False
End If
If Err <> 0 Then Beep: _
MsgBox "Error in " & strProcName & " (1): " _
& Err.Number & " - " & Err.Description: _
Err.Clear: _
GoTo Exit_Section
The error is: Error in SendOutlookMessage(1): 429 - ActiveX component can't
create object.
I have set a reference to Microsoft Outlook 12 Object Library and tried with
both Outlook open and closed before running it. I also moved it onto an
Access 2000 machine and had the same error.
Can anyone see a problem?
code fails to detect Outlook even though it is open, or even try to create a
new instance.
Dim objApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim blnOutlookInitiallyOpen As Boolean
Dim strProcName As String
On Error Resume Next
strProcName = "SendOutlookMessage"
blnOutlookInitiallyOpen = True
Set objApp = GetObject(, "Outlook.Application")
If objApp Is Nothing Then
Set objApp = CreateObject("Outlook.Application")
'* Outlook wasn't open when this function started.
blnOutlookInitiallyOpen = False
End If
If Err <> 0 Then Beep: _
MsgBox "Error in " & strProcName & " (1): " _
& Err.Number & " - " & Err.Description: _
Err.Clear: _
GoTo Exit_Section
The error is: Error in SendOutlookMessage(1): 429 - ActiveX component can't
create object.
I have set a reference to Microsoft Outlook 12 Object Library and tried with
both Outlook open and closed before running it. I also moved it onto an
Access 2000 machine and had the same error.
Can anyone see a problem?