Underline Property

Microsoft Word Visual Basic

Underline Property

       

Returns or sets the type of underline applied to the font or range. Read/write WdUnderline.

WdUnderline can be one of these WdUnderline constants.
wdUnderlineDashHeavy
wdUnderlineDashLongHeavy
wdUnderlineDotDashHeavy
wdUnderlineDotDotDashHeavy
wdUnderlineDottedHeavy
wdUnderlineNone
wdUnderlineThick
wdUnderlineWavyDouble
wdUnderlineWords
wdUnderlineDash
wdUnderlineDashLong
wdUnderlineDotDash
wdUnderlineDotDotDash
wdUnderlineDotted
wdUnderlineDouble
wdUnderlineSingle
wdUnderlineWavy
wdUnderlineWavyHeavy

expression.Underline

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

Example

This example applies a double underline to the fourth word in the active document.

ActiveDocument.Words(4).Underline = wdUnderlineDouble

This example applies a single underline to the selected text.

If Selection.Type = wdSelectionNormal Then
    Selection.Font.Underline = wdUnderlineSingle
Else
    MsgBox "You need to select some text."
End If