Shapes.AddLine Method

PowerPoint Developer Reference

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.

Visual Basic for Applications
  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