Class ChartCharacters (Word VBA)

The class ChartCharacters represents characters in an object that contains text.

Set

To use a ChartCharacters class variable it first needs to be instantiated, for example

Dim ccs as ChartCharacters
Set ccs = ActiveDocument.Background.Chart.ChartTitle.Characters

The following procedures can be used to set variables of type ChartCharacters: AxisTitle.Characters, ChartTitle.Characters, DataLabel.Characters and DisplayUnitLabel.Characters

Caption

Returns the text of this range of characters.

ActiveDocument.Background.Chart.ChartTitle.Characters.Caption =

Count

Returns the number of objects in the collection.

Sub MakeSuperscript() 
 Dim n As Integer 
 
 With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 n = .Chart.Title.Characters.Count 
 .Chart.Title.Characters(n, 1).Font.Superscript = True 
 End If 
 End With 
End Sub

Delete

Deletes the object.

ActiveDocument.Background.Chart.ChartTitle.Characters.Delete

Font

Returns the font of the specified object.

Dim cftFont As ChartFont
Set cftFont = ActiveDocument.Background.Chart.ChartTitle.Characters.Font

Insert

Inserts a string preceding the selected characters.

Syntax : expression.Insert (String)

String: The string to insert.

Dim strString As String: strString =  
ActiveDocument.Background.Chart.ChartTitle.Characters.Insert String:=strString

Parent

Returns the parent for the specified object. Read-only object.

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.ChartTitle.Characters.Parent

PhoneticCharacters

Returns or sets the phonetic text for the object.

With ActiveDocument.InlineShapes(1) 
    If .HasChart Then 
        .Chart.Title.Characters(1,3).PhoneticCharacters = "フリガナ" 
    End If 
End With

Text

Returns or sets the text for the specified object.

ActiveDocument.Background.Chart.ChartTitle.Characters.Text =