Shape.Characters property (Visio)

Returns a Characters object that represents the text of a shape. Read-only.

Syntax

expression. Characters

expression A variable that represents a Shape object.

Return value

Characters

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Characters

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Characters property of a shape to get a Characters object. Once a Characters object has been retrieved, the example uses the Shape property of the Characters object to get the shape that contains the characters and demonstrates that the containing shape has been retrieved by printing its text in the Immediate window.

 
Public Sub Characters_Example() 
  
    Dim vsoOval As Visio.Shape  
    Dim vsoShapeFromCharacters As Visio.Shape  
    Dim vsoCharacters As Visio.Characters  
 
    'Create a shape and add text to it. 
    Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)  
    vsoOval.Text = "Rectangular Shape"  
 
    'Get a Characters object from the oval shape. 
    Set vsoCharacters = vsoOval.Characters  
 
    'Set the Begin and End properties so that we can 
    'replace the word "Rectangular" with "Oval" 
    vsoCharacters.Begin = 0 
    vsoCharacters.End = 11 
    vsoCharacters.Text = "Oval" 
 
    'Use the Shape property of the Characters object 
    'to get the Shape object. 
    Set vsoShapeFromCharacters = vsoCharacters.Shape  
 
    'Print the shape's text to verify that the proper Shape 
    'object was returned.  
    Debug.Print vsoShapeFromCharacters.Text 
  
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.