Looking for VBA code that can FIND and SELECT any text based on its properties
Short Story
I am looking for VBA code to scan through a Word document and select any text that meets specific parameters like (Font = Arial, Text Size= 12, All Caps = True, Text = Bold… and so on.) and then highlight it.
Long story
I am looking for help finishing a macro I have been trying to create for a while now. The overall purpose is to extract the titles from manuals that I have and compare them to a list I have, to confirm they match. I have a portion of the codes I would like to combine, but I am missing the last piece and I cannot find it online or figure it out. I tried finding a way to run the “select text with similar formatting” but it would not record and I could not find anything online that would work.
The steps I have managed so far are as follows:
1. Merge all the manuals into one document.
2. Find and replace the ^p with a “space” (because I would like the title on 1 line)
3. This is the missing step - Select and highlight all the titles (just the titles and stores item No.) in the newly merged document.
4. Extract all the highlighted text onto a new Word document.
5. Add them to my excel list to compare them.
I have created or found everything I need except the 3rd step. Any help would be fantastic because I am not sure where else to look. I will include an attachment that is a template for the manuals I would be reviewing, so I would be combining multiple copies of the file and looking to extract just the titles. Also if someone knows of a better or more efficient method to get the same result please point me in the right direction. I know this is a long post but I wanted to make sure I was as clear as possible, thank you!
|