Name
textframe
.Characters([Start
], [Length
])
Synopsis
Returns a Characters
object representing the text in the text frame.
Argument |
Settings |
---|---|
|
The index of the first character to return |
|
The number of characters to return |
The most commonly used properties of the Characters
object are Text
and Font
. I’ve showed you how to use the Text
property many times so far; the following code changes the font for the last word in the DrawOval
example:
Sub FormatCharacters( ) Dim ws As Worksheet, s As Shape, fil As String Set ws = ActiveSheet ' Draw oval using previous example. DrawOval ' Get the shape object. Set s = ws.Shapes(ws.Shapes.Count) ' Make last word bold. s.TextFrame.Characters(21, 7).Font.Bold = True End Sub
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.