Clicked

Description

Returns the name of the button that was used to dismiss a form

Syntax

oDlg.Clicked

Parameters

Part

Description

oDlg

A reference to the WshDialog.Kit automation object (as returned by the
Wscript or VBScript CreateObject methods)

Example

Option Explicit

Dim oDlg, oFrm

'Create the WshDialog.Kit object and store a reference in oDlg
Set oDlg = Wscript.CreateObject("WshDialog.Kit", "oDlg_")

'Add a form and store a reference to it in the variable oFrm
Set oFrm = oDlg.NewForm

'Add a label and two buttons to the form
oFrm.NewLabel "LBL", 250, 200, 2000, 375, "Do you want to continue ?"
oFrm.NewButton "Yes", 250, 600, 750, 375, "&Yes"
oFrm.NewButton "No", 1250, 600, 750, 375, "&No"
oFrm.AutoSize

'Show the form (modal)
oFrm.Show 1

'Check which button was clicked
Select Case Ucase(oDlg.Clicked)
Case "YES"
    MsgBox "The Yes button was clicked"
Case "NO"
    MsgBox "The No button was clicked"
Case "*CLOSE"
    MsgBox "The Closebox was clicked"
End Select