I am writing a piece of code which parses the paragraphs of a document and uploads relevant bits to a server.
Consider a document in which three paragraphs exist, with Normal style.
The first para contains no additional formatting.
The second para is entirely bolded.
One word only within the third para is bolded.
Now, consider the following macro:
Code:
Public Sub paratest()
Dim i As Integer
For i = 1 To ActiveDocument.Paragraphs.Count
With ActiveDocument.Paragraphs.Item(i)
Debug.Print .Range.Text
Debug.Print "Bold: ".Range.Bold
End With
Next
End Sub
This gives an output like:
Quote:
This is the first paragraph
Bold: 0
This is the second paragraph
Bold: -1
This is the third paragraph
Bold: 9999999
|
In fact, in the 3rd para, the word "third" is bolded, all the rest are not.
How can I programmatically discover which parts (text runs?) within each para have had additional formatting applied?