Setting Text Attributes in the Assistant's Balloon

A new feature in Microsoft Office 2000 is the capability of letting you set attributes to any text in the Assistant's balloon. You can assign text to the Heading and Text properties and to each label and check box in the BalloonLabels and BalloonCheckboxes collections. The following procedure shows a combination of underlining and setting of the color of the text in a balloon.

Sub UnderliningAndColorText()
    With Assistant.NewBalloon
        .Heading = "{cf 252}{ul}Underlining and Text Colors"

        .Text = "This balloon shows a mixture of color " & _
            "text, like {cf 249}Red{cf 0} text, and some " & _
            "underlined {cf 252}{ul 1}Blue{ul 0}{cf 0} text."

        .BalloonType = msoBalloonTypeButtons
        .Labels(1).Text = "{cf 253}{ul}Text " & _
            "is all underlined.{cf 249}{ul 0}"
        .Labels(2).Text = "No underlined or colored text."
        .Labels(3).Text = "Some {ul 1}words underlined."

        .Show
    End With
End Sub

In this example, you set the text of the balloon heading to blue and underlined. The balloon's body text contains a mix of single words that are colored, along with a single word that's underlined. The three labels displayed in the balloon show three kinds of text: underlined, not underlined and at the same time set with the default text color, and with two words underlined.

You should add the syntax {cf number} to set the text's color. In the syntax {cf number}, "number" represents one of the 16 system palette colors listed in the table on the next page. By default, text in the Assistant's balloon is black. If you use a number other than a value listed in the following table in the syntax {cf number}, the text will also be black. To display underlined text, you use the syntax {ul} or {ul 1}. You use the syntax {ul 0} after text where underlining should be turned off. If you don't specify {ul 0} to terminate underlining in a text string, underlining continues to the end of the text string (as the text assigned to the third label in the preceding procedure reveals).

System color numberColorSystem color numberColor
0 Black 248 Medium gray
1 Dark red 249 Red
2 Dark green 250 Green
3 Dark yellow 251 Yellow
4 Dark blue 252 Blue
5 Dark magenta 253 Magenta
6 Dark cyan 254 Cyan
7 Light gray 255 White