LineWidth Property

Microsoft Word Visual Basic

Show All

LineWidth Property

       

Returns or sets the line width of an object's border. Returns a WdLineWidth constant or wdUndefined if the object either has no borders or has borders with more than one line width. Read/write.

WdLineWidth can be one of these WdLineWidth constants.
wdLineWidth025pt
wdLineWidth050pt
wdLineWidth075pt
wdLineWidth100pt
wdLineWidth150pt
wdLineWidth225pt
wdLineWidth300pt
wdLineWidth450pt
wdLineWidth600pt

expression.LineWidth

expression   Required. An expression that returns a Border object.

Remarks

If the specified line width isn't available for the border's line style, this property generates an error. To determine the line widths available for a particular line style, see the Borders and Shading dialog box (Format menu).

Example

This example adds a border below the first row in the first table of the active document.

If ActiveDocument.Tables.Count >= 1 Then
    With ActiveDocument.Tables(1).Rows(1).Borders(wdBorderBottom)
        .LineStyle = wdLineStyleSingle
        .LineWidth = wdLineWidth050pt
    End With
End If

This example adds a wavy, red line to the left of the selection.

With Selection.Borders(wdBorderLeft)
    .LineStyle = wdLineStyleSingleWavy
    .LineWidth = wdLineWidth075pt
    .ColorIndex = wdRed
End With