vba error run-time 429 activex component can't create object - excel & outlook 2007

dgr7

Board Regular
Joined
Apr 5, 2006
Messages
225
hello,
I have some VBA code that in one portion of it an Outlook e-mail is created and the active workbook is attached and sent. This code used to work on Excel & Outlook 2003, but now in Excel & Outlook 2007 I'm getting the error:

Run-time error '429':
ActiveX component can't create object

and is stopping on the line

Set OutApp = GetObject(, "Outlook.Application")

FY If I comment out the Set OutApp... and If OutApp.... lines and uncomment the Set OutApp create object line, I still get the same error.

How do I fix this run-time error so the code will successfully run?
thanks in advance,
david

Code:
 Dim OutApp As Object
    Dim OutMail As Object
    Dim SigString As String
    Dim Signature As String

    'Set OutApp = CreateObject("Outlook.Application")
    Set OutApp = GetObject(, "Outlook.Application")
    If OutApp Is Nothing Then Set OutApp = CreateObject("Outlook.Application")
    
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)



    On Error Resume Next
    With OutMail
        .To = "test@test.com"
        .BCC = ""
        .Subject = ActiveWorkbook.Name
        .HTMLBody = "Please see the_attached workbook " & ActiveWorkbook.Name & ".<br><br>" & Signature
        .Attachments.Add ActiveWorkbook.FullName
        .Display
        '.Send
    End With

    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Going to *bump* as I don't have 07 so can't investigate further ... not having OL client open is often the cause hence the check.

Hopefully someone else has a solution for you.
 
Upvote 0
lasw10, thank you for the assistance.

can anyone help me with this issue?

thanks in advance,
david
 
Upvote 0
Do you have only one version of Outlook installed?
 
Upvote 0
If you set a reference to the Outlook 2007 library in your Excel projectand use code like:
Code:
Dim OutApp as Outlook.Application
Set OutApp = New Outlook.Application
do you get the same error?
 
Upvote 0

Forum statistics

Threads
1,223,521
Messages
6,172,812
Members
452,481
Latest member
Najwan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top