Class Characters (Excel VBA)

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

Set

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

Dim chrs as Characters
Set chrs = ActiveCell.Characters

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

Caption

Returns a String value that represents the text of this range of characters.

ActiveCell.Characters.Caption =

Count

Returns a Long value that represents the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveCell.Characters.Count

Delete

Deletes the object.

ActiveCell.Characters.Delete

Font

Returns a Font object that represents the font of the specified object.

Dim fntFont As Font
Set fntFont = ActiveCell.Characters.Font

Insert

Inserts a string preceding the selected characters.

Insert (String)

String: The string to insert.

Dim strString As String: strString = 
ActiveCell.Characters.Insert String:=strString

Parent

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

PhoneticCharacters

Returns or sets the phonetic text in the specified Characters object.

Instead of using this property, you should use the Add method of the Phonetics collection to add phonetic information to a cell, and use the Text property of the Phonetic object to return or set the phonetic text strings in a cell.

ActiveCell.Characters(1,3).PhoneticCharacters = "フリガナ"

Text

Returns or sets the text for the specified object.

ActiveCell.Characters.Text =