Método Show
Método Show cuando se aplica al objeto Balloon.
Muestra el objeto globo especificado. Devuelve una constante de MsoBalloonButtonType que indica en qué botón o rótulo hace clic el usuario. Es de sólo lectura.
MsoBalloonButtonType puede ser una de estas constantes de MsoBalloonButtonType. |
msoBalloonButtonAbort |
msoBalloonButtonBack |
msoBalloonButtonCancel |
msoBalloonButtonClose |
msoBalloonButtonIgnore |
msoBalloonButtonNext |
msoBalloonButtonNo |
msoBalloonButtonNull |
msoBalloonButtonOK |
msoBalloonButtonOptions |
msoBalloonButtonRetry |
msoBalloonButtonSearch |
msoBalloonButtonSnooze |
msoBalloonButtonTips |
msoBalloonButtonYes |
msoBalloonButtonYesToAll |
expresión.Show
expresión Requerida. Expresión que devuelve un objeto Balloon.
Método Show cuando se aplica al objeto FileDialog.
Muestra un cuadro de diálogo de archivos y devuelve un valor Long que indica si el usuario ha presionado el botón de acción (-1) o el de cancelar (0). Si activa el método Show, no se ejecutará ningún código más hasta que el usuario cierre el cuadro de diálogo de archivos. En el caso de los cuadros de diálogo Guardar como y Abrir, utilice el método Execute después del método Show para ejecutar la acción del usuario.
expresión.Show
expresión Requerida. Expresión que devuelve un objeto FileDialog.
Ejemplo
Cuando se aplica al objeto Balloon.
Este ejemplo crea un globo con dos opciones de rótulos del globo para establecer la orientación de la impresión: Portrait y Landscape. El ejemplo utiliza el método Show en una instrucción Select Case para determinar qué orientación ha elegido el usuario.
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
Este ejemplo crea un globo con tres botones de comando: Yes, No y Cancel. El ejemplo utiliza el método Show en una instrucción Select Case para determinar el valor devuelto del botón en el que el usuario ha hecho clic.
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 -2 ' User selected Cancel button.
returnValue = MsgBox("Operation canceled.", _
vbOKOnly, "Printer Message")
Case -3 ' User selected Yes button.
returnValue = MsgBox("Printer set to " & _
"Landscape.", vbOKOnly, "Printer Message")
Case -4 ' User selected No button.
returnValue = MsgBox("Printer orientation not " & _
"reset.", vbOKOnly, "Printer Message")
End Select
Cuando se aplica al objeto FileDialog.
El ejemplo siguiente muestra un cuadro de diálogo Selector de archivos mediante el objeto File Dialog, así como cada archivo seleccionado en un cuadro de mensaje.
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