## XL5: Control Missing/Incorrect Location After Moving Dialog

The information in this article applies to:

- Microsoft Excel for Windows, version 5.0

## SYMPTOMS

In Microsoft Excel, when you hide a control on a custom dialog box, and you then move the dialog frame on the dialog sheet, when you attempt to redisplay the control in the dialog box, the control is not displayed or it is displayed in the wrong location.

## CAUSE

This behavior occurs because Microsoft Excel does not move hidden objects. Therefore, when you hide a control on a dialog box, and you then move the dialog box frame, the control does not move with the dialog box. Because the control does not move, it either appears in the wrong location on the dialog box or is not displayed on the dialog box at all.

## WORKAROUNDS

To avoid this behavior, do not move the dialog frame when controls on the dialog box are hidden. Instead, use the Visible method in a Visual Basic procedure to display all of the objects on a dialog box, and then move the dialog frame to the desired location on the dialog sheet. The following example displays all of the objects on the Dialog1 dialog sheet:
Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

       Sub Display_All()
          Dim DlgObj As Object
          For Each DlgObj In DialogSheets("Dialog1").DrawingObjects
             DlgObj.Visible = True
          Next
       End Sub

## STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c for Windows.

## REFERENCES

"Visual Basic User's Guide," version 5.0, Chapter 11, "Controls and Dialog Boxes"

Additional query words:

Keywords :
Version : 5.00
Platform : WINDOWS
Issue type :
Technology :

Last Reviewed: September 15, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use.