Microsoft KB Archive/137029

{|
 * width="100%"|

INFO: Techniques for Diagnosing/Resolving OLE Automation Errors

 * }

Q137029

-

The information in this article applies to:


 * Microsoft Visual Basic Standard and Professional Editions for Windows, version 3.0

-

SUMMARY
Applications using OLE Automation may encounter either one of the following two errors:

429 - OLE Automation server can't create object

438 - OLE Automation no such property or method

This article presents some techniques for resolving these errors.

Error 429
Error 429 typically occurs during a CreateObject call. There are several causes for this error:


 * Low System Resources.
 * Corrupt or invalid OLE Registry.
 * Lost connection with the OLE server.

Error 429: Low System Resources
Low system resources are a factor when CreateObject is used to load a specified application that doesn't already exist in memory. You can check system resources and memory at any time by clicking About Program Manager on the Help menu of the Windows Program Manager.

To test memory if you get error 429 in your Visual Basic code, switch to the Program Manager, and try to load the application. If you can't, you are low on system resources or memory. If you can, there may be a problem with either the syntax within CreateObject or with the registry.

Error 429: Corrupt or Invalid OLE Registry
If the OLE Registry is corrupted or invalid, you can use the following steps to restore it:

 Exit windows. If you make these changes within Windows, they will be over-written. Windows stores the Registry in memory and writes it back out to disk when Windows exits. Within the \Windows directory, make a copy of both Reg.dat and Win.ini files. Delete the Reg.dat file. Edit the Win.ini file, and remove the [Embedding] section. Restart Windows. An empty Reg.dat file will be created. Start File Manager. On the file menu, click Search, and find all files on your hard disk that have the .reg extension. That is, search for:  In the search results window, double-click the files that you want to add to the registry. You should, at minimum, double-click these files: Ole2.reg

 Some applications will attempt to automatically re-register themselves on startup. The application will look for key entries in the registry; if none is found, the application will re-register itself. If the entry comes from a second application, this means the first application may not be properly registered. You may have to manually re-register each of your applications using the technique described in this step.  Retry your Visual Basic application.</li></ol>

Error 429: Lost Connection with the OLE Server
Finally, the connection to an object may have been lost. The following code can demonstrate how this can happen:

Dim LoadDC as Object

Dim LoadWd as Object

Set LoadDC = CreateObject( "Word.Document.Doc" )

Set LoadWd = LoadDC.Application.WordBasic

Set LoadDC = Nothing

LoadWd.FileOpen ... As it stands, this code may generate error 429. If the third line of code setting LoadDC to nothing is removed or changed to a comment, it works.

Error 438
Error 438 can be generated when the OLE object created does not recognize the method or property you are attempting to use. This could be something as simple as a syntax error (the method or property you are trying to use is misspelled in your code). Or it could be because the object's connection is no longer available.

Consider the following scenario with OLE Automation between Visual Basic and Microsoft Word:


 * 1) Start Microsoft Word, opening a specific document.
 * 2) Print that document
 * 3) Close the document by using FileClose.
 * 4) Issue another Print command to the document.

This will generate error 438 because the link to the document was lost when it was closed. The syntax for issuing the print is correct but the method is no longer available because there is no document open within Word.