Labels Property

Applies To

Balloon object.

Description

Returns a BalloonLabels collection that represents the button labels, number labels, and bullet labels contained in the specified Office Assistant balloon. Read-only.

Example

This example creates a balloon containing three choices. The variable x is set to the return value of the Show method, which will be 1, 2 or 3, corresponding to the label the user clicks. In the example, a simple message box displays the value of the variable x, but you can pass the value to another procedure, or you can use the value in a Select Case statement.

Set b = Assistant.NewBalloon
With b
    .Heading = "This is my heading"
    .Text = "Select one of these things:"
    .Labels(1).Text = "Choice One"
    .Labels(2).Text = "Choice Two"
    .Labels(3).Text = "Choice Three"
    x = .Show
End With
MsgBox x
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)