Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.4 KB

Publisher.TextFrame.TextRange.md

File metadata and controls

56 lines (41 loc) · 1.4 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
TextFrame.TextRange property (Publisher)
vbapb10.chm3866627
vbapb10.chm3866627
Publisher.TextFrame.TextRange
44a8395e-81dc-7d06-f068-89f77a889f5e
06/15/2019
medium

TextFrame.TextRange property (Publisher)

Returns a TextRange object that represents the text that is attached to a shape and the properties and methods for manipulating the text.

Syntax

expression.TextRange

expression A variable that represents a TextFrame object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes that there is at least one shape on the first page of the active publication.

Sub AddTextToTextFrame() 
 With ActiveDocument.Pages(1).TextFrame.TextRange 
 .Text = "My Text" 
 With .Font 
 .Bold = msoTrue 
 .Size = 25 
 .Name = "Arial" 
 End With 
 End With 
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Sub AddTextToShape() 
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _ 
 Left:=72, Top:=72, Width:=250, Height:=140) 
 .TextFrame.TextRange.Text = "Here is some test text" 
 End With 
End Sub

[!includeSupport and feedback]