Microsoft KB Archive/288614

= Error message when you try to run a Microsoft Visual Basic for Applications macro: &quot;Excel was previously unable to load your toolbar customizations&quot; =

Article ID: 288614

Article Last Modified on 1/6/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Excel 2002 Standard Edition

-



This article was previously published under Q288614



SYMPTOMS
When you run Microsoft Excel 2002 or Microsoft Office Excel 2007, you may receive an error message that resembles the following error message:

Microsoft Excel has encountered a problem and needs to close.

After you receive the first error message, you may receive a second error message that resembles the following error message:

Excel was previously unable to load your toolbar customizations. Would you like to reset your toolbars to their default state?

If you click Yes, Excel opens. However, if you click No, the first error message reappears.



CAUSE
This problem occurs if the following conditions are true:   You run a Microsoft Visual Basic for Applications macro.

This Microsoft Visual Basic for Applications macro resembles the following line of code: CommandBars(&quot;Watch Window&quot;).Controls(1).Reset The Microsoft Visual Basic for Applications macro causes Excel to reset a control on the Watch Window toolbar by using the Reset method.  You then exit and restart Excel.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this problem, do not use the Reset method on the Watch Windows CommandBar object. If you are using a looping structure on the CommandBars collection, exclude the Watch Window toolbar. The following sample code demonstrates this. For Each cmdBar in Application.CommandBars If cmdBar.Visible Then If cmdBar.Name <> &quot;Watch Window&quot; Then cmdBar.Controls(1).Reset End If  End If Next



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
In Excel 2002 and in Excel 2007, the Watch Window toolbar is a pane-style control that does not allow for customization. However, because the Watch Window is considered a toolbar (a CommandBar object in Visual Basic for Applications) and toolbars can be customized, it accepts the Visual Basic for Applications Reset method. If it is reset, Excel 2002 or Excel 2007 is unable to reload the toolbar.

NOTE: This problem does not occur with the Task Pane toolbar. If you try to reset one of its controls, it will return a run-time error.

Additional query words: XL2002 watchwindow crash XL2007

Keywords: kbbug kberrmsg kbpending KB288614

-

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

© Microsoft Corporation. All rights reserved.