After you create a balloon for the Office Assistant, you can customize it by adding bitmaps, icons, or Windows metafiles to the balloon's heading or text. You can add controls such as check boxes or buttons to your balloon so that you can respond to your user when he or she clicks an item in the balloon. You can also use text attributes such as color and underlining to emphasize text elements in a balloon.
Adding icons and bitmaps to balloons
To customize your application, you can add icons and bitmaps to Office Assistant balloons. To add an icon, assign an MsoIconType constant to the Icon property of the Balloon object. To add a bitmap or a Windows metafile to the text in an Office Assistant balloon, specify the type, the location, and the sizing factor (if applicable) when you set the Text property of a heading, text, check box, or label. The following example inserts a Windows bitmap file into the text of a balloon.
myBmp = "{bmp c:\Win95\circles.gif}"
myText1 = "This is before the picture, "
myText2 = " and this is after the picture"
Set bln = Assistant.NewBalloon
With bln
.Heading = "Instructions for Choosing a Bitmap."
.Text = myText1 & myBmp & myText2
.Show
End With
Adding controls to balloons
There are two types of controls you can add to a balloon: check boxes and buttons. There are five check boxes in the balloon when it's created; you can make any one of them visible by specifying text for the control. There are five label buttons in the balloon as well (if the balloon type is msoBalloonTypeButtons), and you can expose any label in the same way you would a check box. If you try to expose more than five check boxes or five label buttons in a balloon, an error occurs.
You can change the appearance of any control on a balloon by changing the control's Text property. You can change the functionality of a check box or a button in a balloon by specifying another procedure that will be run whenever the check box or button is selected (clicked).
The following example creates a balloon with a heading, text, and three region choices. When the user selects one or more check boxes and clicks OK, the example calls the appropriate procedure or procedures.
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
If .CheckBoxes(1).Checked Then
runregion1
End If
If .CheckBoxes(2).Checked Then
runregion2
End If
If .CheckBoxes(3).Checked Then
runregion3
End If
End With
Adding color and underlining to text in balloons
There are two attributes you can add to text in a balloon: color and underlining. There are 16 supported system colors you can use to emphasize text with color. You also can change the appearance of text in a balloon by underlining the text. Text attributes are embedded in the text of the balloon and are surrounded by braces in the code. The following example creates a new Office Assistant balloon that contains underlined heading text, red text, and blue text that is also underlined.
With Assistant.NewBalloon
.Heading = "Underlined {ul 1}Heading{ul 0}"
.Text = "Some {cf 249}Red{cf 0} text and some " & _
"underlined {cf 252}{ul 1}Blue{ul 0}{cf 0} text."
.Show
End With