會傳回一個或多個連接的目標圖形。 唯讀。
語法
運算式。ToSheet
運算式 代表 Connect 物件的變數。
傳回值
圖形
註解
Connect 物件的 ToSheet 屬性一定會傳回此連接的目標圖形。
Connects 集合代表數個連線。 如果集合所代表的每個連線都建立至相同的圖形,則 ToSheet 屬性會傳回該圖形。 否則,它會傳回 Nothing ,且不會引發例外狀況。
範例
此Microsoft Visual Basic for Applications (VBA) 巨集示範如何使用 ToSheet 屬性在 Microsoft Visio 繪圖中尋找 Connect 物件來源的圖形。 此範例會將連接資訊顯示在 [立即] 視窗中。
這個範例假設使用中文件至少包含兩個相連的圖形。 為了獲得最佳結果,請從 [組織圖圖形 ] 樣板連接兩個圖形。
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 支援與意見反應。