Applies To
Dialog Object, DialogSheet Object, Range Object, Scenario Object.
Description
DialogSheet object (Syntax 1): Runs the dialog box. This method will not return to the calling procedure until the dialog box is closed or hidden, but event procedures assigned to the dialog box controls will run while the calling procedure is suspended.
Range object (Syntax 1): Scrolls the active window to move the range into view. The range must consist of a single cell which is a part of the currently active document
Scenario object (Syntax 1): Shows the scenario by inserting the scenario's values onto the worksheet. The affected cells are the changing cells of the scenario.
Dialog object (Syntax 2): Displays the dialog box and waits for the user to input data.
Syntax 1
object.Show
Syntax 2
object.Show(arg1, arg2, ..., arg30)
object
Required. For Syntax 1, the DialogSheet, Range, or Scenario object. For Syntax 2, the Dialog object.
arg1, arg2, ..., arg30
Optional. For built-in dialog boxes only, provides the initial arguments for the command. For more information, see the following Remarks section.
Remarks
For built in dialog boxes, this method returns True if the user clicked OK, or False if the user clicked Cancel.
A single dialog box can change many properties at once. For example, the Format Cells dialog box can change all the properties of the Font object.
For some built-in dialog boxes (Open, for example), you can set initial values using arg1, arg2, ..., arg30.
Example
This example displays the custom dialog box Dialog1, and then it displays a message if you do not press the Cancel button. Before running this example, create a new default dialog sheet by pointing to Macro on the Insert menu and then clicking Dialog.
If DialogSheets("Dialog1").Show <> False Then MsgBox "You must have pressed the ""OK"" button" End If
This example displays the Open dialog box and selects the Read-Only option.
Application.Dialogs(xlDialogOpen).Show arg3:=True