macro not working in Excel 2010

robertdseals

Active Member
Joined
May 14, 2008
Messages
337
Office Version
  1. 2010
Platform
  1. Windows
Hello,
I've got a macro that sends out an email based on information in an Excel spreadsheet. It ran fine in version 2003. Now that I've upgraded, I get this error when I try to run it.
[h=1]Run-time error '429': ActiveX component can't create object[/h]Here's the macro:
Code:
Sub SendEmail()
    Dim OutlookApp As Object
    Dim MItem As Object
    Dim cell As Range
    Dim email_ As String
    Dim subject_ As String
    Dim body_ As String
    Dim attach_ As String
Application.Workbooks.Open ("\\tc-file1\rseals\Documents\participationEmails.xlsx")


     'Create Outlook object
    Set OutApp = CreateObject("Outlook.Application")
     
     'Loop through the rows
    For Each cell In Columns("a").Cells.SpecialCells(xlCellTypeConstants)
         
        email_ = cell.Value
        subject_ = cell.Offset(0, 1).Value
        body_ = cell.Offset(0, 2).Value
        attach_ = cell.Offset(0, 3).Value
         
         
         
         'Create Mail Item and send it
        Set MItem = OutlookApp.CreateItem(0)
        With MItem
            .To = email_
            .Subject = subject_
            .Body = body_
            .Attachments.Add attach_
            .send
        End With
    Next
End Sub
 
Last edited by a moderator:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Your variable seem mixed up. Should it be

Code:
'Create Outlook object
 Set OutlookApp = CreateObject("Outlook.Application")
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,176
Members
452,893
Latest member
denay

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