AddLine Method

Microsoft PowerPoint Visual Basic

AddLine Method

       

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

expression.AddLine(BeginX, BeginY, EndX, EndY)

expression   Required. An expression that returns one of the objects in the Applies To list.

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.

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