Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Error When Function Contains a Breakpoint


View products that this article applies to.

This article was previously published under Q213558

↑ Back to the top


Symptoms

In Microsoft Excel, when you type or edit a formula in a worksheet, you may receive the following error message:
This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.
If you click Details, you receive an error message similar to one or more of the following:
EXCEL caused an invalid page fault in module EXCEL.EXE at 014f:300960ef.
BINDER caused an exception 6bfH in module KERNEL32.DLL at 014f:bff9a080.
When these messages appear, the Microsoft Office programs may close or stop responding.

↑ Back to the top


Cause

This problem may occur when all of the following conditions are true:
  • You edit or type a formula in a Microsoft Excel worksheet that is stored in Microsoft Office Binder or an embedded worksheet in Microsoft Word or Microsoft PowerPoint. For example, you type the following formula:
    =Test()
    -and-
  • The formula refers to a custom Microsoft Visual Basic for Applications function. For example:
          Function Test()
              A = 1
              B = 2
              Test = A + B
          End Function
    						

    -and-
  • The workbook was saved with a breakpoint set within the custom function.
NOTE: A breakpoint may be set manually by using the Toggle Breakpoint command on the Debug menu or programmatically by using the Stop statement.

↑ Back to the top


Workaround

To prevent this problem from occurring, do not set a breakpoint in the custom function. If you need to pause or break your macro at run-time, use the MsgBox function or the End statement instead.

For more information about the MsgBox function, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type MsgBox function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

When you set a breakpoint in a custom function, and then type a formula that refers to that function, Microsoft Excel displays the Visual Basic Editor in break mode. You can then step through the macro code by pressing F8, or you can press F5 to continue running the code. You can also set watches and perform other tasks.

In Visual Basic for Applications, follow these steps to set a breakpoint in a custom function or subroutine:

  1. Move the insertion point to line of code where you want to set the breakpoint.
  2. Press F9, or click Toggle Breakpoint on the Debug menu.
The line of code turns a maroon color and a maroon colored dot appears to the left of the code.

NOTE: You can also remove a breakpoint by following the same steps.

When you use a Microsoft Office program that contains an embedded Microsoft Excel workbook, and you type or edit a formula that refers to a custom function containing a breakpoint, Microsoft Excel and the Microsoft Office program may stop responding. Microsoft recommends that you do not set a breakpoint in a custom function when you are working in Microsoft Office Binder or your workbook is embedded in another Microsoft Office program.

↑ Back to the top


Keywords: KB213558, kbprogramming, kbpending, kberrmsg, kbdtacode, kbbug

↑ Back to the top

Article Info
Article ID : 213558
Revision : 5
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 470