+ Reply to Thread
Results 1 to 4 of 4

Set OutApp = CreateObject("Outlook.Application") - Runtime error 429

  1. #1
    Buffyslay
    Guest

    Set OutApp = CreateObject("Outlook.Application") - Runtime error 429

    Send Emails

    Ok -

    I have the following code (posted at bottom) that errors out at

    **Set OutApp = CreateObject("Outlook.Application")**

    the error message is

    Run-time error 429
    ActvieX component cannot create object


    I have the reference set
    (You must add a reference to the Microsoft outlook Library.

    1) Go to the VBA editor, Alt -F11
    2) Tools>References in the Menu bar
    3) Place a Checkmark before Microsoft Outlook 9 Object Library
    )


    It works on other machines (PCs with the same build as mine) so where
    am i going wrong?


    Sub sendEmails()
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Dim cell As Range

    Application.ScreenUpdating = False


    Set OutApp = CreateObject("Outlook.Application")

    On Error GoTo cleanup
    For Each cell In Sheets("Send
    Emails").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
    If cell.Offset(0, 1).Value <> "" Then
    If cell.Offset(0, 1).Value <> "" Then

    Set OutMail = OutApp.CreateItem(olMailItem)
    With OutMail
    .To = cell.Value
    .Subject = "Budget for " & cell.Offset(0, 2).Value
    .Body = "Dear " & cell.Offset(0, -1).Value & vbCrLf &
    vbCrLf
    .Body = .Body & "Please find attached latest update
    showing the actuals against budget for " & cell.Offset(0, 2).Value &
    vbCrLf & vbCrLf

    If cell.Offset(0, 3) <> "" Then
    .Body = .Body & cell.Offset(0, 3).Value & vbCrLf &
    vbCrLf
    End If
    If cell.Offset(0, 4) <> "" Then
    .Body = .Body & cell.Offset(0, 4).Value & vbCrLf &
    vbCrLf
    End If
    .Body = .Body & "If you have any queries
    - please let me know. " & vbCrLf & vbCrLf
    .Body = .Body & "Many thanks " & vbCrLf & vbCrLf
    .Body = .Body & "Systems Finance Team" & vbCrLf &
    vbCrLf
    .Attachments.Add cell.Offset(0, 1).Value
    .Display 'Or use Display
    If cell.Offset(0, 5) = "Y" Then
    .ReadReceiptRequested = True
    Else
    .ReadReceiptRequested = False
    End If
    End With
    Set OutMail = Nothing
    End If
    End If
    Next cell
    Exit Sub


  2. #2
    Buffyslay
    Guest

    Re: Set OutApp = CreateObject("Outlook.Application") - Runtime error 429

    i tried

    Private Sub Form_Click()
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("c:\testfile.txt", True)
    a.WriteLine ("This is a test.")
    a.Close
    End Sub

    which worked...?


  3. #3
    Ron de Bruin
    Guest

    Re: Set OutApp = CreateObject("Outlook.Application") - Runtime error 429

    Hi Buffyslay

    Start with this KB
    http://support.microsoft.com/default...b;en-us;828550

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Buffyslay" <[email protected]> wrote in message news:[email protected]...
    > Send Emails
    >
    > Ok -
    >
    > I have the following code (posted at bottom) that errors out at
    >
    > **Set OutApp = CreateObject("Outlook.Application")**
    >
    > the error message is
    >
    > Run-time error 429
    > ActvieX component cannot create object
    >
    >
    > I have the reference set
    > (You must add a reference to the Microsoft outlook Library.
    >
    > 1) Go to the VBA editor, Alt -F11
    > 2) Tools>References in the Menu bar
    > 3) Place a Checkmark before Microsoft Outlook 9 Object Library
    > )
    >
    >
    > It works on other machines (PCs with the same build as mine) so where
    > am i going wrong?
    >
    >
    > Sub sendEmails()
    > Dim OutApp As Outlook.Application
    > Dim OutMail As Outlook.MailItem
    > Dim cell As Range
    >
    > Application.ScreenUpdating = False
    >
    >
    > Set OutApp = CreateObject("Outlook.Application")
    >
    > On Error GoTo cleanup
    > For Each cell In Sheets("Send
    > Emails").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
    > If cell.Offset(0, 1).Value <> "" Then
    > If cell.Offset(0, 1).Value <> "" Then
    >
    > Set OutMail = OutApp.CreateItem(olMailItem)
    > With OutMail
    > .To = cell.Value
    > .Subject = "Budget for " & cell.Offset(0, 2).Value
    > .Body = "Dear " & cell.Offset(0, -1).Value & vbCrLf &
    > vbCrLf
    > .Body = .Body & "Please find attached latest update
    > showing the actuals against budget for " & cell.Offset(0, 2).Value &
    > vbCrLf & vbCrLf
    >
    > If cell.Offset(0, 3) <> "" Then
    > .Body = .Body & cell.Offset(0, 3).Value & vbCrLf &
    > vbCrLf
    > End If
    > If cell.Offset(0, 4) <> "" Then
    > .Body = .Body & cell.Offset(0, 4).Value & vbCrLf &
    > vbCrLf
    > End If
    > .Body = .Body & "If you have any queries
    > - please let me know. " & vbCrLf & vbCrLf
    > .Body = .Body & "Many thanks " & vbCrLf & vbCrLf
    > .Body = .Body & "Systems Finance Team" & vbCrLf &
    > vbCrLf
    > .Attachments.Add cell.Offset(0, 1).Value
    > .Display 'Or use Display
    > If cell.Offset(0, 5) = "Y" Then
    > .ReadReceiptRequested = True
    > Else
    > .ReadReceiptRequested = False
    > End If
    > End With
    > Set OutMail = Nothing
    > End If
    > End If
    > Next cell
    > Exit Sub
    >




  4. #4
    Registered User
    Join Date
    02-29-2012
    Location
    Tegelen
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Set OutApp = CreateObject("Outlook.Application") - Runtime error 429

    Windows 7 with Excel en Outlook 2010.

    Had the same problem. Didn't find any solution on the internet that helped. I compared to registries from different PC's.
    There is a key in the registry named outlook.application.14. On the Windows 7 machine where the script gave no errors there also was a key named outlook.application. This key contains info like
    CLSID en Current Version. Exported that key en added this registry entry on the Windows 7 with the issue. After that the script works. The only problem remaining is that he pops up with a profile choice for Outlook. If you open Outlook first than this is gone. Good Luck.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1