robertdseals
Active Member
- Joined
- May 14, 2008
- Messages
- 337
- Office Version
- 2010
- Platform
- 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:
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: