Shapes.AddLine method (PowerPoint)

Creates a line. Returns a Shape object that represents the new line.

Syntax

expression. AddLine( _BeginX_, _BeginY_, _EndX_, _EndY_ )

expression A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
BeginX Required Single The horizontal position, measured in points, of the line's starting point relative to the left edge of the slide.
BeginY Required Single The vertical position, measured in points, of the line's starting point relative to the top edge of the slide.
EndX Required Single The horizontal position, measured in points, of the line's ending point relative to the left edge of the slide.
EndY Required Single The vertical position, measured in points, of the line's ending point relative to the top edge of the slide.

Return value

Shape

Example

This example adds a blue dashed line to myDocument.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes.AddLine(BeginX:=10, BeginY:=10, _
        EndX:=250, EndY:=250).Line
    .DashStyle = msoLineDashDotDot
    .ForeColor.RGB = RGB(50, 0, 128)
End With

See also

Shapes Object

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.