Font.Bold property (Publisher)
Returns or sets an MsoTriState constant that represents the state of the Bold property on the characters in a text range. Read/write.
Syntax
expression.Bold
expression A variable that represents a Font object.
Return value
MsoTriState
Remarks
The Bold property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.
Constant | Description |
---|---|
msoFalse | None of the characters in the range are formatted as bold. |
msoTriStateMixed | A return value indicating that the range contains some text formatted as bold and some text not formatted as bold. |
msoTriStateToggle | A set value that switches between msoTrue and msoFalse. |
msoTrue | All characters in the range are formatted as bold. |
Example
This example tests all the text in the second story of the active publication, and if it contains both bold text and not bold text, it sets all the text to bold. If the text is all bold or all not bold, a message is displayed informing the user that there is no mixed bolding. For this code to execute properly, there must be two or more stories with text in the active publication.
Sub BoldStory()
Dim stf As Publisher.Font
Set stf = Application.ActiveDocument.Stories(2).TextRange.Font
With stf
If .Bold = msoTriStateMixed Then
.Bold = msoTrue
Else
MsgBox "Mixed bolding is not in this story."
End If
End With
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.