我只想在选择后连接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
答案 0 :(得分:0)
您已经明确了shpShapes
,但是您还没有定义它......
Set shpShapes = ActiveWindow.View.Slide.Shapes
当然,在运行代码之前,您需要确保选择了2个形状。
希望这有帮助!