共用方式為


Visio (的 Shape.Characters 屬性)

會傳回代表圖形之文字的 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 支援與意見反應