簡體   English   中英

VBA:選擇PowerPoint形狀后如何連接它們

[英]VBA: how to connect powerpoint shapes after selecting them

選擇它們后,我只想連接2個正方形。

我的以下代碼無法正常工作,看不到如何解決:

Sub ConnectSelectedShapes()

Dim shpFirst As Shape
Dim shpSecond As Shape

Dim shpShapes As Shapes

Set shapesRange = ActiveWindow.Selection.ShapeRange

Set shpFirst = shapesRange(1)
Set shpSecond = shapesRange(2)

With shpShapes.AddConnector(Type:=msoConnectorCurve, BeginX:=0, _
        BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat

    .BeginConnect ConnectedShape:=shpFirst, ConnectionSite:=1
    .EndConnect ConnectedShape:=shpSecond, ConnectionSite:=1
    .Parent.RerouteConnections

End With

End Sub

您已經研究過shpShapes ,但是尚未定義它...

Set shpShapes = ActiveWindow.View.Slide.Shapes

並且,當然,在運行代碼之前,您需要確保已選擇2個形狀。

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM