The Assistant object model provides two types of controls you can display in the Assistant balloon—up to five Label controls and up to five Check Box controls; when you specify the text of either a label or a check box, it's displayed in the balloon. However, you can't position the controls within the balloon: the set of labels is always displayed before the set of check boxes.
Sub DisplayOfficeAssistant() Dim bln As Office.Balloon Set bln = Assistant.NewBalloon With bln .Heading = "File Search" .Text = "To conduct a file search, " & _ "follow the steps outlined below." .BalloonType = msoBalloonTypeNumbers .Labels(1).Text = "Specify a file extension in " & _ "the text box next to the label 'Enter a " & _ "file extension'." .Labels(2).Text = "Click the Search button." .Labels(3).Text = "To display these steps again, " & _ "click the Assistant button." .Button = msoButtonSetOK .Mode = msoModeModal .Show End With End Sub |
The BalloonType property of the Balloon object indicates whether the labels specified by the Label property appear as a numbered list, a bulleted list, or a list with circular buttons. You specify the numbered list with msoBalloonTypeNumbers, the bulleted list with msoBalloonTypeBullets, and the button list with msoBalloonTypeButtons. Because you're listing a set of steps, you want to set the button type to a numbered list. Because you specified the text of three of the five Label controls, three items will be in the numbered list.
The following procedure displays the Assistant's balloon with three check boxes added. Because the Mode property isn't set and by default the mode is set to msoModeModal, the balloon is displayed in a modal state. Thus, when you execute this procedure, code doesn't execute after the Show method is executed until the user dismisses the balloon. Once the balloon is closed, the lines following the Show method are executed, which allows your code to query the state of the check boxes.
Sub DisplayCheckboxes() Dim i as Integer With Assistant.NewBalloon .Heading = "Using Check Boxes" .Text = "Check any check box." For i = 1 To 3 .Checkboxes(i).Text = "Item " & i Next .Show If .Checkboxes(1).Checked Then Debug.Print "Checkbox 1 is checked." End If If .Checkboxes(2).Checked Then Debug.Print "Checkbox 2 is checked." End If If .Checkboxes(3).Checked Then Debug.Print "Checkbox 3 is checked." End If End With End Sub |
Place the cursor in the DisplayCheckboxes procedure and press F5 to run it. Select one or more check boxes and click OK. The three If...Then statements after the Show method of the Balloon object evaluate the checked state of the check box. If the user selected the check box, text is printed to the Immediate window indicating the box is checked.