Microsoft KB Archive/72616

{|
 * width="100%"|

Custom Dialog Box Leaves Copy on Screen When Moved in Excel

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0
 * Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0

-

SUMMARY
When a movable custom dialog box is created in Microsoft Excel, it will leave a copy of itself in the original location when moved if an =ECHO(FALSE) command is included in the macro before the dialog box is called.

NOTE: This information applies when using Excel 4.0 macros when using Microsoft Excel 5.0

MORE INFORMATION
Microsoft Excel provides the ability to create custom dialog boxes that can be moved. This is accomplished by entering a title for the dialog box in the text column of the first line in the dialog box definition. This creates a title bar and control menu (-) for the dialog box when it is displayed. The dialog box may then be moved by clicking the title bar and dragging the box or by accessing the control menu (-) and selecting Move. The latter technique allows you to move the dialog box without a mouse.

When an =ECHO(FALSE) command is included in the macro prior to the =DIALOG.BOX(range) command, and the dialog box is then moved to a new position, it will still be displayed in the original location. This is because the =ECHO(FALSE) command suspends screen updating while the macro is running. The macro is not completed until after the dialog box is removed from the screen, so the original location of the dialog box is not redrawn until this time.

The solution to this problem is to remove the =ECHO(FALSE) function from the macro, or to insert an =ECHO(TRUE) command into the macro prior to the =DIALOG.BOX function.

Note that movable custom dialog boxes were not possible in Excel 2.x.