Shapes.AddConnector method (Publisher)

Adds a new Shape object representing a connector to the specified Shapes collection.

Syntax

expression.AddConnector (Type, BeginX, BeginY, EndX, EndY)

expression A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
Type Required MsoConnectorType The type of connector to add. Can be one of the MsoConnectorType constants, except for msoConnectorTypeMixed, which is not used with this method.
BeginX Required Variant The x-coordinate of the beginning point of the connector.
BeginY Required Variant The y-coordinate of the beginning point of the connector.
EndX Required Variant The x-coordinate of the ending point of the connector.
EndY Required Variant The y-coordinate of the ending point of the connector.

Return value

Shape

Remarks

For the BeginX, BeginY, EndX, and EndY parameters, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The new connector isn't connected to any other shape; use the BeginConnect and EndConnect methods to connect the new connector to another shape.

Example

The following example adds a new straight-line connector to the first page of the active publication.

Dim shpConnect As Shape 
 
Set shpConnect = ActiveDocument.Pages(1).Shapes.AddConnector _ 
 (Type:=msoConnectorStraight, _ 
 BeginX:=144, BeginY:=144, _ 
 EndX:=180, EndY:=72)

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.