Adding Connectors

Pdj

New Member
Joined
Mar 1, 2013
Messages
11
I am trying to add a connector to a selected shape. I want the user to be able to select the shape and then run the VBA that will use the selected shape and add a connector. Is this possible?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi.

I would think so.

You can try it with the Macro Recorder to see what is going on and you can try this macro that encapsulates some of the ideas:
Code:
Sub Connect()
    Dim sh As Shape
    
    With ActiveSheet
        .Shapes.AddShape(msoShapeOval, 200, 100, 100, 100).Name = "Oval_1"
        .Shapes.AddShape(msoShapeOval, 200, 400, 100, 100).Name = "Oval_2"
        Set sh = .Shapes.AddConnector(msoConnectorStraight, 150, 100, 150, 400)
        sh.Line.EndArrowheadStyle = msoArrowheadTriangle
        sh.ConnectorFormat.BeginConnect .Shapes("Oval_1"), 5
        sh.ConnectorFormat.EndConnect .Shapes("Oval_2"), 1
    End With

End Sub
It adds two circles and a connector then it joins the circles using the connector.

Regards,
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,840
Members
449,411
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top