Article ID: 122488 - Last Review: December 8, 2003 - Revision: 3.0 PRB: How to Use Automation Error Code & Help from Visual BasicThis article was previously published under Q122488 On This PageSYMPTOMS
Visual Basic version 3.0 does not report automation errors that result from
OLE automation exceptions. Instead, it reports an err value of 440 and a
description string of "OLE Automation exception." The actual wCode passed
by the automation server is lost.
STATUS
This behavior is by design in Visual Basic version 3.0. Visual Basic for
Applications, included in Excel version 5.0, Visual Basic 4.x and later,
and other Microsoft products, returns the wCode correctly.
MORE INFORMATION
When an MFC automation server throws an OLE dispatch exception by calling
AfxThrowOleDispatchException, an object of class COleDispatchException is
built. Its member variables include an OLE SCODE, a help context, string
error description, and wCode (an integer code used by Visual Basic).
The only information that the Visual Basic automation controller preserves is the string description. However, the MFC OLE automation server can preserve the information used in the call to AfxThrowOleDispatchException() and expose an additional "Help" method that uses this information to provide help to the user. From within the Visual Basic error handling code, Err is 440, Error(Err) is "OLE Dispatch Exception" and Error$ is the actual string passed by the server. Sample Code Snippets
APPLIES TO
| Article Translations
|

Back to the top
