Skip to content

Latest commit

 

History

History
79 lines (51 loc) · 2.01 KB

Word.Shapes.AddLine.md

File metadata and controls

79 lines (51 loc) · 2.01 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Shapes.AddLine method (Word)
vbawd10.chm161415182
vbawd10.chm161415182
Word.Shapes.AddLine
d1c609c3-d5d1-80e8-4f95-184a9a536feb
06/08/2017
medium

Shapes.AddLine method (Word)

Adds a line to a drawing canvas.

Syntax

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

expression Required. 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 drawing canvas.
BeginY Required Single The vertical position, measured in points, of the line's starting point, relative to the drawing canvas.
EndX Required Single The horizontal position, measured in points, of the line's endpoint, relative to the drawing canvas.
EndY Required Single The vertical position, measured in points, of the line's endpoint, relative to the drawing canvas.

Return value

Shape

Remarks

To create an arrow, use the Line property to format a line.

Example

This example adds a purple line with an arrow to a new drawing canvas.

Sub NewCanvasLine() 
 Dim shpCanvas As Shape 
 Dim shpLine As Shape 
 
 'Add new drawing canvas to the active document 
 Set shpCanvas = ActiveDocument.Shapes _ 
 .AddCanvas(Left:=100, Top:=75, _ 
 Width:=150, Height:=200) 
 
 'Add a line to the drawing canvas 
 Set shpLine = shpCanvas.CanvasItems.AddLine( _ 
 BeginX:=25, BeginY:=25, EndX:=150, EndY:=150) 
 
 'Add an arrow to the line and sets the color to purple 
 With shpLine.Line 
 .BeginArrowheadStyle = msoArrowheadDiamond 
 .BeginArrowheadWidth = msoArrowheadWide 
 .ForeColor.RGB = RGB(Red:=150, Green:=0, Blue:=255) 
 End With 
End Sub

See also

Shapes Collection Object

[!includeSupport and feedback]