Bold Property

Microsoft Word Visual Basic

Bold Property

       

True if the font or range is formatted as bold. Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle. Read/write Long.

Example

This example formats the sixth word in a new document as bold.

Set newDoc = Documents.Add
Set myRange = newDoc.Content
myRange.InsertAfter "This is a test of bold."
myRange.Words(6).Bold = True

This example makes the entire selection bold if part of the selection is formatted as bold.

If Selection.Type = wdSelectionNormal Then
    If Selection.Font.Bold = wdUndefined Then _
        Selection.Font.Bold = True
Else
    MsgBox "You need to select some text."
End If

This example toggles the bold format for the selected text.

If Selection.Type = wdSelectionNormal Then
    Selection.Range.Bold = wdToggle
End If

This example makes the first paragraph in the active document bold.

ActiveDocument.Paragraphs(1).Range.Bold = True