Share via


ConnectShapes Method [Visio 2003 SDK Documentation]

Connects two or more selected shapes with a dynamic connector. Returns Nothing.

object**.ConnectShapes**()

object    Required. An expression that returns a Selection object that contains the shapes to connect.

Version added

2003

Remarks

Calling the ConnectShapes method is equivalent to clicking Connect Shapes on the Shape menu.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ConnectShapes method to connect two shapes.

Public Sub ConnectShapes_Example()

    Dim vsoShape1 As Visio.Shape
    Dim vsoShape2 As Visio.Shape

    Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(2, 9, 4, 7)
    Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(5, 6, 7, 3)

    ActiveWindow.DeselectAll
    ActiveWindow.Select vsoShape1, visSelect
    ActiveWindow.Select vsoShape2, visSelect
    Application.ActiveWindow.Selection.ConnectShapes

End Sub

Applies to | Selection object