Hi,
I created an application in MS Access 2000. Since upgrading to MS
Access 2003 I have been finding all sorts of strange things. My current
problem is with the function below. Ig get an error "429 ActiveX
Componant Can't Create Object"
How can I correct this error?
Thanks very Much!
Kathy
Here is the function:
' By Glen Appleton found in Google Group
'================================================= ======================
====
' Send an email message from Access in default or HTML format
'================================================= ======================
====
Public Function SendEmail(DisplayMsg As Boolean, _
SendTo As String, _
Subject As String, _
Body As String, _
Optional CCTo As String, _
Optional BCCTo As String, _
Optional AttachmentPath) As Boolean
On Error GoTo SendEmail_Err
' Use late binding to avoid Outlook library version compatibility
'problems
Dim objOutlook As Object ' Outlook application
Dim objOutlookMsg As Object ' Outlook message
Dim objOutlookRecip As Object ' Outlook recipients
Dim objOutlookAttach As Object ' Outlook attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Check session and exit if offline
'If objOutlook.Session.Offline Then GoTo EndSendMessage
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
' Add the To recipient(s) to the message.
.To = SendTo
' Add the CC recipient(s) to the message.
If Not CCTo = "" Then .CC = CCTo
' Add the BCC recipient(s) to the message.
'If Not BCCTo = "" Then .BCC = BCCTo
' Set the Subject, Body, and Importance of the message.
.Subject = Subject
'If InStr(1, Body, "<html>", vbBinaryCompare) >= 1 Then
' .HTMLBody = Body & vbCrLf & vbCrLf
'Else
.Body = Body & vbCrLf & vbCrLf
' End If
.Importance = 2 'High importance
' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
'*Set objOutlookAttach = .Attachments.Add(AttachmentPath)
'End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
' .Save
'.Send
End If
End With
EndSendMessage:
Set objOutlook = Nothing
Set objOutlookMsg = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
SendEmail = True
Exit Function
SendEmail_Err:
MsgBox "The e-mail has been canceled."
SendEmail = False
Exit Function
End Function
*** Sent via Developersdex http://www.developersdex.com ***