Text Property

Microsoft Office Object Model

Show All

Text Property

       

Some of the content in this topic may not be applicable to some languages.

BalloonLabel or BalloonCheckbox object: Returns or sets the text displayed next to a check box or label in the Office Assistant balloon. Read/write String.

Balloon object: Returns or sets the text displayed after the heading but before the labels or check boxes in the Office Assistant balloon. Read/write String.

CommandBarComboBox object: Returns or sets the text in the display or edit portion of the command bar combo box control. Read/write String.

HTMLProjectItem object: Returns or sets the HTML text in the HTML editor. Read/write String.

expression.Text

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

For the Balloon, BalloonLabel, and BalloonCheckbox objects, you can specify that a particular graphic be displayed by using the following syntax: {type location sizing_factor}, where type is bmp (bitmap) or wmf (Windows metafile); location is the resource ID or the path and file name; and sizing_factor denotes the width of the .wmf file (sizing_factor is omitted for .bmp files).

The Balloon object also supports underlined text and text that has one of the 16 system palette colors applied to it. To display underlined text, use the syntax {ul} or {ul 1}; use {ul 0} to turn underlining off. To change the color of text, precede the text string with the character sequence {cf number}, where number is one of the system color numbers listed in the following table.

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

If you specify a number other than one of the preceding system color numbers, the text in the Office Assistant balloon is black.

Example

This example creates a new command bar named "Custom" and adds to it a combo box that contains four list items. The example then uses the Text property to set Item 3 as the default list item.

Set myBar = CommandBars _
    .Add(Name:="Custom", Position:=msoBarTop, _
    Temporary:=True)
With myBar
    .Controls.Add Type:=msoControlComboBox, ID:=1
    .Visible = True
End With
Set testComboBox = CommandBars("Custom").Controls(1)
With testComboBox
    .AddItem "Item 1", 1
    .AddItem "Item 2", 2
    .AddItem "Item 3", 3
    .AddItem "Item 4", 4
    .Text = "Item 3"
End With

This example creates a new Office Assistant balloon with a heading, text, and three region choices. The example uses the Text property to provide balloon-related instructions to the user and a label for each text box.

With Assistant.NewBalloon
    .Heading = "Regional Sales Data"
    .Text = "Select a region"
    For i = 1 To 3
        .CheckBoxes(i).Text = "Region " & i
    Next
    .Show
End With

This 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

This example creates a new Office Assistant balloon that contains a Windows metafile.

With Assistant.NewBalloon
    .Heading = "Underlined {ul 1}Heading{ul 0}"
    .Text ="{WMF ""C:\Favorites\MyPicture.WMF""}"
    .Show
End With