VBA - Paragraphs
Toggling the display of the Paragraph Marks
Use the Format property to return the ParagraphFormat object for a paragraph or paragraphs.
The ParagraphFormat property returns the ParagraphFormat object for a selection, range, style, Find object, or Replacement object.
wdUndefined and wdToggle
This value cannot be set as a value but might be returned when a Range contains several different types of formatting.
Lets imagine that the first paragraph in a document contains both bold and not bold text.
This code will change all the text to bold when there is a mixture of bold and not bold and toggle the bold when it either all bold or all not bold.
ParagraphFormat Object
Borders
Shading
This example sets Formatting Paragraphs for a range that includes the entire contents of MyDoc.doc. Paragraphs in this document are double-spaced and have a custom tab stop at 0.25 inch.
This example modifies the Heading 2 style for the active document. Paragraphs formatted with this style are indented to the first tab stop and double-spaced.
You can use Visual Basic's New keyword to create a new, standalone ParagraphFormat object. The following example creates a ParagraphFormat object, sets some formatting properties for it, and then applies all of its properties to the first paragraph in the active document.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext