Checkboxes Property
Applies To
Balloon object.
Description
Returns the BalloonCheckboxes collection that represents all the check boxes contained in the specified balloon. Read-only.
See Also
Balloon object, Checked property.
Example
This example creates a balloon with a heading, text, and three region choices. When the user selects a check box and then clicks OK in the balloon, the appropriate procedure is run.
With Assistant.NewBalloon
.Heading = "Regional Sales Data"
.Text = "Select your region"
For i = 1 To 3
.CheckBoxes(i).Text = "Region " & i
Next
.Button = msoButtonSetOkCancel
.Show
Select Case True
Case .CheckBoxes(1).Checked
runregion1
Case .CheckBoxes(2).Checked
runregion2
Case .CheckBoxes(3).Checked
runregion3
End Select
End With
Example (Microsoft Access)
The following function creates a custom balloon for the Office Assistant and determines how the user responded to the balloon:
Function AssistantBalloon(Optional varCheck As Variant, _
Optional varLabel As Variant)
Dim bch As BalloonCheckbox
Dim intI As Integer
Dim intReturn As Integer
Dim strCheck(5) As String
Dim strList As String
' Create new balloon.
Set bal = Assistant.NewBalloon
' Specify balloon type.
bal.BalloonType = msoBalloonTypeButtons
' Specify that balloon is modal.
bal.Mode = msoModeModal
' Make Assistant visible.
If Assistant.Visible = False Then Assistant.Visible = True
' Check if first argument has been passed.
If Not IsMissing(varCheck) Then
' If too large, set to maximum number of check boxes (5).
If varCheck > 6 Then
varCheck = 5
End If
' Set text property to alphabet character.
For intI = 1 To varCheck
bal.Checkboxes(intI).Text = Chr(64 + intI)
Next intI
End If
If Not IsMissing(varLabel) Then
' If too large, set to maximum number of labels (5).
If varLabel > 6 Then
varLabel = 5
End If
For intI = 1 To varLabel
' Set text property to alphabet character.
bal.Labels(intI).Text = Chr(64 + intI)
Next intI
End If
' Store return value.
intReturn = bal.Show
intI = 0
' Determine which check boxes were checked, if any.
For Each bch In bal.Checkboxes
If bch.Checked = True Then
strCheck(intI) = bch.Text
strList = strList & "'" & strCheck(intI) & "'" & Chr(32)
End If
intI = intI + 1
Next
If Len(strList) <> 0 Then
MsgBox "You selected checkboxes " & strList & "."
End If
' Determine which label was selected, if any.
If intReturn > 0 Then
MsgBox "You selected label " & bal.Labels(intReturn).Text & "."
End If
End Function
You could call this function from the Debug window as follows:
? AssistantBalloon(4, 5)