I have a Word Document that was created by saving a PDF document as a Word Document. The PDF document has some text that was highlighted in Yellow. I need to detect the highlighted text. I guess the conversion is not perfect. Some of the text in the Word Document is showing that it is highlighted, and some just has a Yellow background but is not showing as being highlighted. I can select some of the text and click on the highlight button on the menu and it shows a highlight color, and for some of the words, it shows No Color.
Also in the VBA immediate window if I type
?selection.formattedtext.highlightcolorindex, I get 7 for some selections, and 0 for others.
For those selections that do not show up as highlighted, how can I detect them?
Update: I selected a "Highlighted" word and executed call Selection.ClearFormatting and the font changed, but the yellow highlight remained. So that tells me that the yellow highlight is not a format. I also selected No Color with the text selected and the yellow highlight remained. I have verified that it is neither Highlight or Shading. Hmmm... What could be causing the highlight?
Update: I discovered that if I delete the "highlighted text" that is not really highlighted, the text that is to the right of the deleted text moves over to the left and the highlight remains. So then I discovered that I can Select the highlight if there is no text under a portion of the highlight. Then I can drag the highlight to another portion of the page. So, this highlight is an object. If I right click on it, I have options such as Format Object.
So now I know that these "Highlights" are actually like objects. If there is no text under the object, I can grab it and drag it around. How can I, using VBA, find these types of objects?
What I really want is the entire paragraph under the highlight objects. Is that possible?