Run-time Error '429'; ActiveX component can't create object

M

muyBN

I get the above message upon running the following code. I tried the
suggestions in the Help issue and I have set the references in the VBE.


Dim blnStarted As Boolean, objOutlookApp As Outlook.Application, objItem As
Outlook.MailItem
~~
Set objOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set objOutlookApp = CreateObject("Outlook.Application")
blnStarted = True
End If
Set objItem = objOutlookApp.CreateItem(olMailItem)
With objItem
..To = strEmail
..Subject = strSubject
..Body = strBody
..Display
End With
Set objItem = Nothing
Set objOutlookApp = Nothing
 
M

muyBN

Thanks for your response. The line with GetObject is the one that throws the
error.

Actually, I had a similar problem that I posted as an issue in the Outlook
forum. The person there suggested that I put "On Error Resume Next" before
the GetObject line and "On Error GoTo 0" after it. At first, that suggestion
didn't make sense to me but after I did it and resolved the problem, it
started making more sense: If the application isn't running, you can't "get"
it. If it's not running, it throws an error and you have to create it.
 

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