Publisher) (ConnectorFormat.BeginConnectedShape 屬性

會傳回代表指定連接線的起點所連接之圖案的 Shape 物件。

語法

運算式。BeginConnectedShape

運算式 代表 ConnectorFormat 物件的變數。

傳回值

圖形

註解

如果指定連接線的起點並不連接到圖案,將會發生錯誤。

使用 EndConnectedShape 屬性可傳回與連接線的終點相連的圖形。

範例

此範例假設使用中出版物的第一頁已包含兩個由名為 Conn1To2 的連接器附加的圖形。 程式碼會在第一頁新增矩形和連接線。 新連接器的開頭將與名為 Conn1To2 的連接器開頭連接至相同的連接站點,而新連接器的結尾將貼附至新矩形上的連接站點 1。

Dim shpNew As Shape 
Dim intSite As Integer 
Dim shpOld As Shape 
 
With ActiveDocument.Pages(1).Shapes 
 
 ' Add new rectangle. 
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _ 
 Left:=450, Top:=190, Width:=200, Height:=100) 
 
 ' Add new connector. 
 .AddConnector(Type:=msoConnectorCurve, _ 
 BeginX:=0, BeginY:=0, EndX:=10, EndY:=10) _ 
 .Name = "Conn1To3" 
 
 ' Get connection site number of old shape, and set 
 ' reference to old shape. 
 With .Item("Conn1To2").ConnectorFormat 
 intSite = .BeginConnectionSite 
 Set shpOld = .BeginConnectedShape 
 End With 
 
 ' Connect new connector to old shape and new rectangle. 
 With .Item("Conn1To3").ConnectorFormat 
 .BeginConnect ConnectedShape:=shpOld, _ 
 ConnectionSite:=intSite 
 .EndConnect ConnectedShape:=shpNew, _ 
 ConnectionSite:=1 
 End With 
End With 

支援和意見反應

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