Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Returns a TextRange object that represents the specified subset of text characters.
Syntax
expression.Characters (Start, Length)
expression A variable that represents a TextRange object.
Parameters
| Name | Required/Optional | Data type | Description |
|---|---|---|---|
| Start | Required | Long | The first character in the returned range. |
| Length | Optional | Long | The number of characters to be returned. Default is 1. |
Return value
TextRange
Remarks
If Start is greater than the number of characters in the specified text, the returned range starts with the last character in the specified range.
If Length is greater than the number of characters from the specified starting character to the end of the text, the returned range contains all those characters.
Example
This example sets the text for the first shape on the first page in the active document, and then sets the font of the first two characters to 15 points and bold.
Sub CharRange()
Dim rngCharacters As TextRange
Set rngCharacters = Application.ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.InsertBefore(NewText:="Hello World.")
With rngCharacters.Characters(Start:=1, Length:=2).Font
.Size = 15
.Bold = msoTrue
End With
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.