XL: Problems Using Show Method to Open Dialog Sheets

ID: Q111308

The information in this article applies to:

SUMMARY

In Microsoft Excel, when you use the Show method to display a dialog box, the dialog box must be closed or hidden before you can return to the Visual Basic procedure that called it.

MORE INFORMATION

The Show method runs a specified dialog box, either by running event procedures immediately, or by running the dialog box and waiting for the user to enter data.

If the dialog box is called during a procedure in which another dialog box is already present, the Show method will run the dialog box on top of the present dialog box. To return to the calling procedure, the second dialog box must be closed or hidden.

Closing the Dialog Box

If the dialog box has a button with the DismissButton property set to TRUE:

When you Click a button with the DismissButton property set to TRUE, you will automatically close a user-defined dialog box. This is the preferred approach, because the DismissButton property will validate all edit fields before closing the dialog box and the Show method will return TRUE if validation succeeds. If validation does not succeed, an alert is displayed and the invalid edit field is activated.

If your dialog box does not contain a DismissButton that is set to TRUE, the dialog box can be closed by doing one of the following:

REFERENCES

For more information about the Show Method, click the Search button in Visual Basic help and type:

   Show Method

For more information about the Hide Method, click the Search button in Visual Basic help and type:

   Hide Method

For more information about the DismissButton Procedure, click the Search button in Visual Basic help and type:

   DismissButton Procedure

For more information about the CancelButton Procedure, click the Search button in Visual Basic help and type:

   CancelButton Procedure

Additional query words: 5.00 7.00 8.00 97 VB memory VBE
Keywords          : kbdta PgmOthr PgmHowto KbVBA 
Version           : WINDOWS: 5.0,5.0c,7.0,7.0a,97; MACINTOSH: 5.0,5.0a
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto

Last Reviewed: December 9, 1998