Microsoft KB Archive/238190

= WD97: VBA Stops and Does Not Enter Break Mode When "Break on Unhandled Errors" Selected =

Article ID: 238190

Article Last Modified on 1/24/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q238190



SYMPTOMS
If you set Visual Basic for Applications error trapping to Break on Unhandled Errors and a module that raises an error is within the ThisDocument class module, the execution of the Visual Basic for Applications code does not continue after the error is encountered; nor does a break into the code occur, as documented. In addition, when errors do occur, the dialog box is different than expected.



CAUSE
The ThisDocument module is a class module and therefore error trapping in this module behaves differently for the Break on Unhandled Errors and Break on All Errors settings.

With the Break on Unhandled Errors setting, breaking within class module code is disabled; whereas with the Break on All Errors and Break in Class Module settings, breaking within class modules is enabled for error trapping, and the code that handles these error trapping conditions is different. Local error handling within the ThisDocument class module behaves as expected.

This trapping behavior with the Break on Unhandled Errors setting allows the code within the class modules to be treated as private data not to be exposed when errors occur. Although explicit error handling is recommended to obtain expected results and provide proper clean up when errors occur, the Break on Unhandled Errors setting provides a generic level of error handling.



MORE INFORMATION
Microsoft Visual Basic for Applications has three levels of error reporting:
 * Break on Unhandled Errors
 * Break in Class Module
 * Break on All Errors

To set these in the Visual Basic for Applications Editor, click Options on the Tools menu, and then click the General tab.

Keywords: kbhotfixserver kbqfe kbprb kbprogramming kbqfe KB238190

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.