LineFormat Members

Use the LineFormat object to change the appearance of line shapes. Use the Shape object’s Line property to get a reference to this collection. The LineFormat object has the following members:

Application

BackColor

BeginArrowheadLength

BeginArrowheadStyle

BeginArrowheadWidth

Creator

DashStyle

EndArrowheadLength

EndArrowheadStyle

EndArrowheadWidth

ForeColor

Parent

Pattern

Style

Transparency

Visible

Weight

 

Use the LineFormat object to add an arrowhead to a line, set the line weight, and set the style as shown by the following code:

Sub LineFormatMembers( )
    Dim ws As Worksheet, s As Shape
    Set ws = ActiveSheet
    ' Draw a line.
    Set s = ws.Shapes.AddLine(60, 60, 200, 200)
    ' Add an arrowhead.
    s.Line.BeginArrowheadStyle = msoArrowheadOpen
    s.Line.BeginArrowheadLength = msoArrowheadLengthMedium
    s.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
    s.Line.EndArrowheadStyle = msoArrowheadOval
    ' Change line weight (in points)
    s.Line.Weight = 4
    ' Change line style.
    s.Line.DashStyle = msoLineDash
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.