Show Method

Microsoft Office Visual Basic

Displays the specified balloon object. Returns an MsoBalloonButtonType constant that indicates which button or label the user clicked in the balloon.

MsoBalloonButtonType can be one of these MsoBalloonButtonType constants.
msoBalloonButtonAbort
msoBalloonButtonBack
msoBalloonButtonCancel
msoBalloonButtonClose
msoBalloonButtonIgnore
msoBalloonButtonNext
msoBalloonButtonNo
msoBalloonButtonNull
msoBalloonButtonOK
msoBalloonButtonOptions
msoBalloonButtonRetry
msoBalloonButtonSearch
msoBalloonButtonSnooze
msoBalloonButtonTips
msoBalloonButtonYes
msoBalloonButtonYesToAll

expression.Show

expression    Required. An expression that returns a Balloon object.

ShowShow method as it applies to the FileDialog object.

Displays a file dialog box and returns a Long indicating whether the user pressed the action button (-1) or the cancel button (0). When you call the Show method, no more code will execute until the user dismisses the file dialog box. In the case of Open and SaveAs dialog boxes, use the Execute method right after the Show method to carry out the user's action.

expression.Show

expression    Required. An expression that returns a FileDialog object.

Example

ShowAs it applies to the Balloon object.

This example creates a balloon containing two balloon label choices for setting printer orientation: Portrait and Landscape. The example uses the return value from the Show method in a Select Case statement to determine which orientation the user has chosen.

Set balNew = Assistant.NewBalloon
With balNew
    .Heading = "Please choose a printer orientation"
    .Labels(1).Text = "Portrait"
    .Labels(2).Text = "Landscape"
    .Button = msoButtonSetNone
End With

Select Case balNew.Show
    Case 1
        ' Insert code to set printer to Portrait.
    Case 2
        ' Insert code to set printer to Landscape.
End Select
				

This example creates a balloon containing three command buttons: Yes, No, and Cancel. The example uses the return value from the Show method in a Select Case statement to determine the button clicked by the user.

Set balNew = Assistant.NewBalloon
With balNew
    .Heading = "Are you sure you want to set the " & _
        "printer orientation to Landscape?"
    .BalloonType = msoBalloonTypeButtons
    .Button = msoButtonSetYesNoCancel
End With

Select Case balNew.Show
    Case msoBalloonButtonCancel  ' User selected Cancel button.
        returnValue = MsgBox("Operation canceled.", _
            vbOKOnly, "Printer Message")
    Case msoBalloonButtonYes  ' User selected Yes button.
        returnValue = MsgBox("Printer set to " & _
            "Landscape.", vbOKOnly, "Printer Message")
    Case msoBalloonButtonNo  ' User selected No button.
        returnValue = MsgBox("Printer orientation not " & _
            "reset.", vbOKOnly, "Printer Message")
End Select
				

ShowAs it applies to the FileDialog object.

The following example displays a File Picker dialog box using the FileDialog object and displays each selected file in a message box.

Sub Main()

    'Declare a variable as a FileDialog object.
    Dim fd As FileDialog

    'Create a FileDialog object as a File Picker dialog box.
    Set fd = Application.FileDialog(msoFileDialogFilePicker)

    'Declare a variable to contain the path
    'of each selected item. Even though the path is a String,
    'the variable must be a Variant because For Each...Next
    'routines only work with Variants and Objects.
    Dim vrtSelectedItem As Variant

    'Use a With...End With block to reference the FileDialog object.
    With fd

        'Use the Show method to display the File Picker dialog box and return the user's action.
        'The user pressed the action button.
    If .Show = -1 Then

            'Step through each string in the FileDialogSelectedItems collection.
            For Each vrtSelectedItem In .SelectedItems

                'vrtSelectedItem is a string that contains the path of each selected item.
                'You can use any file I/O functions that you want to work with this path.
                'This example simply displays the path in a message box.
                MsgBox "The path is: " & vrtSelectedItem

            Next vrtSelectedItem
        'The user pressed Cancel.
    Else
        End If
    End With

    'Set the object variable to nothing.
    Set fd = Nothing

End Sub