468,768 Members | 1,613 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,768 developers. It's quick & easy.

Create Object error after ugrading to Access 2003

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 ***
Nov 13 '05 #1
1 1894
>>
' Use late binding to avoid Outlook library version compatibility
'problems
<<

The above may be your problem, or part of your problem. I believe
Access2003 is stricter on stuff as far as

...CreateObject("Outlook.Application.Version")

If you are using Outlook11 I think you need to add that to the
CreateObject statement. Also, I would use early binding instead of late
binding --- make sure you have a reference to the correct Outlook
libary.

Dim objOutlook As Outlook.Application
...

It is much better to generate version compatability problems at the
beginning of a project than farther down the road when you have already
developed stuff and late binding is just not going to forgive you any
longer for incompatability issues. Note: the less forgiving a system is
- the less undesired surprises you get down the road.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Susan Bricker | last post: by
9 posts views Thread by Marc Miller | last post: by
5 posts views Thread by Michael | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.