共用方式為


Visio) (Connects.ToSheet 屬性

會傳回一個或多個連接的目標圖形。 唯讀。

語法

運算式ToSheet

表達 代表 Connects 物件的 變數。

傳回值

圖形

註解

Connect 物件的 ToSheet 屬性一定會傳回此連接的目標圖形。

Connects集合代表數個連接。 如果集合所表示的每個連接都與相同的圖案建立, ToSheet 屬性會傳回該圖案。 否則,它會傳回 Nothing ,而且不會引發例外狀況。

範例

這個 Microsoft Visual Basic for Applications (VBA) 宏會示範如何使用 ToSheet 屬性來尋找 Connect 物件源自于 Microsoft Visio 繪圖中的圖形。 此範例會將連接資訊顯示在 [立即] 視窗中。

這個範例假設使用中文件至少包含兩個相連的圖形。 為了獲得最佳結果,請從 組織結構 圖形樣板連接兩個圖形。

 
Public Sub ToSheet_Example() 
 
 Dim vsoShapes As Visio.Shapes 
 Dim vsoShape As Visio.Shape 
 Dim vsoConnectTo As Visio.Shape 
 Dim vsoConnects As Visio.Connects 
 Dim vsoConnect As Visio.Connect 
 Dim intCurrentShapeIndex As Integer 
 Dim intCounter As Integer 
 Set vsoShapes = ActivePage.Shapes 
 
 'For each shape on the page, get its connections. 
 For intCurrentShapeIndex = 1 To vsoShapes.Count 
 
 Set vsoShape = vsoShapes(intCurrentShapeIndex) 
 Set vsoConnects = vsoShape.Connects 
 
 'For each connection, get the shape it connects to. 
 For intCounter = 1 To vsoConnects.Count 
 
 Set vsoConnect = vsoConnects(intCounter) 
 Set vsoConnectTo = vsoConnect.ToSheet 
 
 'Print the name of the shape the 
 'Connect object connects to. 
 Debug.Print vsoConnectTo.Name 
 
 Next intCounter 
 
 Next intCurrentShapeIndex 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應