Shape.Characters 属性 (Visio)

返回代表形状文本的 Characters 对象。 此为只读属性。

语法

expressionCharacters

表达 一个代表 Shape 对象的变量。

返回值

Characters

备注

如果 Visual Studio 解决方案包含 Microsoft.Office.Interop.Visio 引用,则此属性映射到以下类型:

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

示例

以下 Microsoft Visual Basic for Applications (VBA) 宏显示如何使用形状的 Characters 属性获取 Characters 对象。 当已检索到 Characters 对象后,该示例将立即使用 Characters 对象的 Shape 属性获取包含字符的形状,并通过在“立即”窗口打印包含形状的文本来说明已经检索到该包含形状。

 
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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。