VBA - Formatting
Obtains a collection of all the font names that are currently available
Note the loop variable must be either an object variable or a variable of type Variant
It cannot be a string variable, as would otherwise be appropriate here.
Difference between Text and FormattedText
objRange.Text = the objects unformatted text
objRange.FormattedText - returns a range object that represents the text and the formatting
The FormattedText property has a special use and that is to transfer text and formatting from one range to another
Clear Formatting
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.
Effects
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext