How to Fix runtime error 429 in excel

How to Fix runtime error 429 in excel. When you use the New operator or the CreateObject function in Microsoft Visual Basic to create an instance of a Microsoft Office application, you may receive the following error message: Run-time error ‘429’: ActiveX component can’t create object

This error occurs when the Component Object Model (COM) cannot create the requested Automation object, and the Automation object is, therefore, unavailable to Visual Basic. This error does not occur on all computers.

This article describes how to diagnose and resolve common problems that may cause this error.

How to Fix runtime error 429 in excel
How to Fix runtime error 429 in excel

More Information

In Visual Basic, there are several causes of error 429. The error occurs if any of the following conditions is true:

  • There is a mistake in the application.

  • There is a mistake in the system configuration.

  • There is a missing component.

  • There is a damaged component.

To find the cause of the error, isolate the problem. If you receive the “429” error message on a client computer, use the following information to isolate and resolve the error in Microsoft Office applications.

Note Some of the following information may also apply to non-Office COM servers. However, this article assumes that you want to automate Office applications.

Examine the code

Before you troubleshoot the error, try to isolate a single line of code that may be causing the problem.

If you discover that a single line of code may be causing the problem, complete these procedures:

  • Make sure that the code uses explicit object creation.

    Problems are easier to identify if they are narrowed down to a single action. For example, look for implicit object creation that’s used as one of the following.

    Code sample 1

    Application.Documents.Add 'DON'T USE THIS!!

    Code sample 2

    Dim oWordApp As New Word.Application 'DON'T USE THIS!!
    '... some other code
    oWordApp.Documents.Add

    Both of these code samples use implicit object creation. Microsoft Office Word 2003 does not start until the variable is called at least one time. Because the variable may be called in different parts of the program, the problem may be difficult to locate. It may be difficult to verify that the problem is caused when the Application object is created or when the Document object is created.

    Instead, you can make explicit calls to create each object separately, as follows.

    Dim oWordApp As Word.Application
    Dim oDoc As Word.Document
    Set oWordApp = CreateObject("Word.Application")
    '... some other code
    Set oDoc = oWordApp.Documents.Add

    When you make explicit calls to create each object separately, the problem is easier to isolate. This may also make the code easier to read.

  • Use the CreateObject function instead of the New operator when you create an instance of an Office application.

    The CreateObject function closely maps the creation process that most Microsoft Visual C++ clients use. The CreateObject function also permits changes in the CLSID of the server between versions. You can use the CreateObject function with early-bound objects and with late-bound objects.

  • Verify that the “ProgID” string that is passed to
    CreateObject is correct, and then verify that the “ProgID” string is version independent. For example, use the “Excel.Application” string instead of using the “Excel.Application.8” string. The system that fails may have an older version of Microsoft Office or a newer version of Microsoft Office than the version that you specified in the “ProgID” string.

  • Use the Erl command to report the line number of the line of code that does not succeed. This may help you debug applications that cannot run in the IDE. The following code tells you which Automation object cannot be created (Microsoft Word or Microsoft Office Excel 2003):

    Dim oWord As Word.Application
     Dim oExcel As Excel.Application
     
     On Error Goto err_handler
     
     1: Set oWord = CreateObject("Word.Application")
     2: Set oExcel = CreateObject("Excel.Application")
     
     ' ... some other code
     
     err_handler:
       MsgBox "The code failed at line " & Erl, vbCritical

    Use the MsgBox function and the line number to track the error.

  • Use late-binding as follows:

  • Dim oWordApp As Object