Solve the CreateOjbect ("Excel. Application") Error

Source: Internet
Author: User
In Visual Basic, there are multiple causes of error 429. This error occurs if any of the following conditions are met:

An error occurs in the application.
System configuration error.
A component is missing.
A component is damaged.

To find out the cause of the error, you must isolate it. If you receive error 429 on the client computer, use the following information to isolate and resolve errors in Microsoft Office applications.

Note:: Some of the following information may also apply to non-office com servers. However, this document assumes that you want to automatically execute the office application.

Check Code


Try to isolate a line of code that may cause the problem before resolving the error.

If you find a line of code that may cause problems, complete these steps:

Make sure that the code is created using an explicit object.

If you narrow down the problem to a single operation, it is easier to identify the problem. For example, find the Code created using an implicit object, as shown in one of the following examples.

Sample Code 1

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

Sample Code 2

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

The above two code examples use an implicit object to create. Microsoft Office Word 2003 does not start until at least one variable is called. The variable may be called in different parts of the program, so it may be difficult to find the problem. It may be difficult to verify that it is createdApplicationThe object is still being createdDocumentObject.

You can call it explicitly to create each object, as shown below.

Dim oWordApp As Word.ApplicationDim oDoc As Word.DocumentSet oWordApp = CreateObject("Word.Application")'... some other codeSet oDoc = oWordApp.Documents.Add

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

When creating an office application instance, useCreateObjectFunction, instead of usingNewOperator.

CreateobjectFunctions are closely mapped to the creation process used by most Microsoft Visual C ++ clients.CreateobjectThe function also allows you to change the server CLSID between versions. You canCreateobjectFunctions are used together with early-bound objects and later-bound objects.

Verification passedCreateObjectAnd then verify that the "progid" string is independent of the version. For example, use the "Excel. Application" string instead of the "Excel. application.8" string. The failed system may be earlier than or newer than the Microsoft Office version specified in the "progid" string.
UseErlCommand to report the line number of the failed code line. This may help you debug applications that cannot be run in the IDE. The following code cannot be createdAutomationObject (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

UseMsgboxFunction and row number to track errors.

Later binding is used, as shown below:

Dim oWordApp As Object

The custom interfaces for objects to be bound earlier must be encapsulated across process boundaries. IfCreateobjectOrNewIf the user-defined interface cannot be sent during this period, the system will receive error 429. Later, the bound object uses the IDispatch system-defined interface that does not need to be sent to the custom proxy. Use a later bound object to verify whether the process works correctly.

If the problem only occurs when the object is bound earlier, the problem occurs in the server application. In general, you can reinstall the application as described in the "check Automation server" section in this article to correct the problem.

Check Automation server


OccurredCreateobjectOrNewThe most common cause of related errors is a problem with the server application. Generally, application configuration or installation may cause this problem. To solve the problem, use the following process:

Verify that the Office application you want to run automatically is installed on your local computer. Make sure you can run the application. To do this, click Start and run, and then try to run the application. If the application cannot be run manually, the application cannot work in an automated manner.
Re-register the application as follows:

1. Click Start, and then click Run ".
2. In the "run" dialog box, type the server path and add/regserver to the end of the line.
3. Click OK ".

Applications run in silent mode. The application is re-registered as a COM server.

If a problem occurs because a registry key is missing, the above steps can usually correct the problem.

Check the localserver32 items of the application to be automatically executed under clsid. Make sure that localserver32 points to the correct location of the application. Make sure that the path name is in the DOS 8.3 format. You do not need to use the short path name to register the server. However, in some systems, long path names containing embedded spaces may cause problems.

To check the path items stored for the server, start the Windows Registry Editor as follows:

1. Click Start, and then click Run ".
2. Type regedit and click OK ".
3. Move to HKEY_CLASSES_ROOT/CLSID.

The clsid of the automatic server registered on the system is located under this item.

4. Use the following values of the CLSID item to find the items that represent the Office application to be automatically executed. Check the path in LocalServer32 of the CLSID item.

Office Server CLSID item
Access. Application {73a4c9c1-d68d-11d0-98bf-00a0c90dc8d9}
Excel. Application {00024500-0000-0000-c000-000000000046}
FrontPage. Application {04df1015-7007-11d1-83bc-006097abe675}
Outlook. Application {0006f03a-0000-0000-c000-000000000046}
Owerpoint. Application {91493441-5a91-11cf-8700-00aa0060263b}
Word. Application {000209FF-0000-0000-C000-000000000046}
5. Make sure that the path matches the actual location of the file.

Note:: The short path name may seem correct, but it is not. For example, the short paths of office and Microsoft Internet Explorer (if they are installed in their default location) are similar to C:/progra ~ 1/micros ~X/(WhereXIs a number ). This name does not initially look like a short path name.

To determine whether the path is correct, perform the following steps:

1. Click Start, and then click Run ".
2. Copy the value from the Registry, and then paste the value in the "run" dialog box.

Note:: Delete before running the application/AutomationSwitch.

3. Click OK ".
4. Verify that the application is running properly.

If the application can run after you click OK, the server is correctly registered. If the application does not run after you click OK, replace the value of localserver32 with the correct path. If yes, use the short path name.

Test whether the Normal. dot template or Excel. xlb resource file may be damaged. If the Normal. dot template in Word or the Excel. xlb resource file in Excel is corrupted, a problem may occur when Microsoft Word or Microsoft Excel is automatically executed. To test these files, search for the local hard drive to find all instances of Normal. dot or Excel. xlb.

Note:: For systems running Microsoft Windows 2000 or Microsoft Windows XP, multiple copies of these files may be found. Each of these files has a copy corresponding to each user configuration file installed on the system.

Temporarily rename the normal. Dot file or the Excel. xlb file, and then re-run the automated test. If Word and Excel cannot find these files, they will create these files. Verify that the code is working. If you create a new normal. Dot file, delete the renamed file. These files are corrupted. If the Code does not work, you must rename these files to their original file names to save any custom settings saved in these files.

If the system runs Windows 2000, the application runs under the administrator account. The Office server requires read/write access to the registry and disk drive. If the current security settings reject read/write access, the Office Server may not be loaded correctly.

Check System


System configuration may also cause non-process COM server creation problems. To solve the problem, use the following process on the system where an error occurs:

Determine whether the problem occurs on any out-of-process server. If you have applications that use a specific COM server (such as Word), test other out-of-process servers to ensure that the problem does not occur on the COM layer. If you cannot create an out-of-process COM server on your computer, reinstall the OLE system file as described in the "reinstall Microsoft Office" section in this article, or reinstall the operating system to solve the problem.
Check the version number of the managed automated OLE system file. These files are usually installed as collections. These files must match the internal version number. The installation utility with incorrect configuration may mistakenly install these files separately. This causes file mismatch. To avoid automation problems, check the file to ensure that the file version matches.

The automatic file is located in the Windows/system32 directory or WINNT/system32 directory. Check the following files.

File Name Version Modification date
Asycfilt. dll 3.50.5014 September 04, 2002
Oleaut32.dll 3.50.5016 September 04, 2002
Olepro32.dll 5.0.5014 September 04, 2002
Stdole2.tlb 3.0.5014 September 04, 2002

To check the file version, right-click the file in Windows Resource Manager and click "properties ". Note the last four digits (internal version number) of the file version and the last modification date of the file. Make sure these values are the same for all automated files.

Note:: Earlier versions and earlier dates are retrieved from Windows Server 2003 computers with Office 2003 installed. These numbers and dates are only used as examples. Your values may be different.

If the file does not match the internal version number or modification date, download the self-extracting utility for updating the automation file.

For more information about how to access the runtime file, click the following article number to view the article in the Microsoft Knowledge Base:

235420 (http://support.microsoft.com/kb/235420/) VBRun60sp4.exe install Visual Basic 6.0 SP4 runtime File
For third-party applications that may restrict code running in Office applications, use the System Configuration Utility (Msconfig.exe) to check service and system startup. For more information about Msconfig.exe, click the following article number to view the article in the Microsoft Knowledge Base:

310560 (http://support.microsoft.com/kb/310560/) how to use the System Configuration Utility in Windows XP to troubleshoot

For example, Outlook automation applications may fail because you are running an anti-virus program with the script blocking function.

Note:: Disable anti-virus programs only on the test system that is not connected to the network.

Alternatively, perform the following steps in outlook to disable third-party add-ons:

1. On the Tools menu, click options ".
2. On the other tab, click Advanced options ".
3. In the advanced Options dialog box, click Add-on manager ".
4. Click the check box for any third-party add-on to clear it.
5. Restart outlook.

If this method solves the problem, contact a third-party anti-virus vendor to learn more about updating the anti-virus program.

Reinstall the Office


If the problem persists, delete the Office and reinstall the office. Microsoft recommends that you first delete an existing version and then reinstall the Office by using the original installation disk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.