VBA Error #429: ActiveX component can't create object

G

Guest

Hi,

I have a VBA procedure which sends an email. This procedure was running
fine when I was on Windows Professional 2000. Last week I was upgrade to
Windows XP, and now when I run the code I get the following error message:

VBA Error #429: ActiveX component can't create object

I’ve confirmed that I have the Microsoft Outlook 11.0 Object Library
registered.

When I run the code on another computer operating on Windows Professional
2000, I do not receive this error.

The code is below:

Function SendEmail(ByRef olTo As String, ByRef olCc As String, ByRef olBcc
As String, _
ByRef olSubj As String, ByRef Acqid As String, ByRef
Internal As Boolean)
On Error GoTo email_error
Dim msg As String
Dim path As String
Dim path2 As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem

'***Procedure fails at the preceeding step***
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

DoCmd.SetWarnings False

With MailOutLook
.BodyFormat = olFormatRichText
.To = olTo
.CC = olCc
.Bcc = olBcc
.Subject = olSubj
Call getBodyMsg(msg, path, Internal)
.Body = msg
.attachments.Add (path & Acqid & ".xls")
path2 = Left(path, Len(path) - 19) & "Database Files\"
.attachments.Add (path2 & "Cover Sheet.xls")

.Send

End With

DoCmd.SetWarnings True

Exit Function
email_error:
MsgBox "An error has occured. Please take a screen shot of this
error" & vbCrLf & _
"and forward it to the system administrator." & vbCrLf & vbCrLf
& _
"Error Number " & Err.Number & ": " & Err.Description,
vbCritical, "ERROR"
Resume Error_out
Error_out:


End Function

****

Does anyone know how I would go about curing this error?

Thanks in advance for your assistance.

Manuel
 
T

Tony Toews [MVP]

Manuel said:
Hi,

I have a VBA procedure which sends an email. This procedure was running
fine when I was on Windows Professional 2000. Last week I was upgrade to
Windows XP, and now when I run the code I get the following error message:

VBA Error #429: ActiveX component can't create object

The problem may not be in Outlook but in Access.

You might need to register the DAO dll using regsvr32. For example
regsvr32 "C:\Program Files\Common Files\Microsoft
Shared\DAO\DAO360.DLL". (If A97 then DAO350.DLL.)

ACC: Error Message: ActiveX Component Can't Create Object [Q296205]
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q296205

ACC2000: Error Message: ActiveX Component Can't Create Object
http://support.microsoft.com/support/kb/articles/q296/2/04.asp

ACC2002: Err Msg: "ActiveX Component Can't Create Object"
http://support.microsoft.com/support/kb/articles/q304/1/73.asp
I’ve confirmed that I have the Microsoft Outlook 11.0 Object Library
registered.

Now are all your users running the same version of Office? If there
is a possibility they will be running different versions of Outlook
then I'd consider converting your code to use Late Binding.

Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.

You'll want to install the reference if you are programming or
debugging and want to use the object intellisense while in the VBA
editor. Then,. once your app is running smoothly, remove the
reference and setup the late binding statements.

For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm

DoCmd.SetWarnings False

DoCmd.SetWarnings True

The above statements aren't actually doing much if anything at all in
your code. I'd let the error handler do it's thing. But if you do
want to leave them in I'd make very, very sure I put DoCmd.SetWarnings
True at the top of your error handling routine right below the
email_error tag.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top