Is it possible to search in Word for phrases based on their font, without VBA?
I want to search a document and extract what are ostensibly titles but not so identified in Word. When I find them, I want to copy and paste them into a different document with each title phrase on its on line. IOW I also want the para marker for each phrase.
Search Based on Font
-
- UraniumLounger
- Posts: 9274
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Search Based on Font
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Search Based on Font
Activate the Find tab of the Find and Replace dialog.
Leave the 'Find what' box empty.
Click 'More >>' to display the extra options.
Select Font ...from the Format... dropdown near the bottom of the dialog.
Select the font name you're searching for, and only if necessary other characteristics such as size, style and color.
Click OK.
Click 'Find Next'.
Leave the 'Find what' box empty.
Click 'More >>' to display the extra options.
Select Font ...from the Format... dropdown near the bottom of the dialog.
Select the font name you're searching for, and only if necessary other characteristics such as size, style and color.
Click OK.
Click 'Find Next'.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- UraniumLounger
- Posts: 9274
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Re: Search Based on Font
Thank you, Hans.
The process is working; however, when I find an instance and click on the found text which is highlighted and try to copy and paste it, nothing happens.
The document contains copious instances of the font. Is there a way to find all of them at once before copying and pasting?
The process is working; however, when I find an instance and click on the found text which is highlighted and try to copy and paste it, nothing happens.
The document contains copious instances of the font. Is there a way to find all of them at once before copying and pasting?
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Search Based on Font
To select and copy them all in one go would require a macro.
You can select Reading Highlight > Highlight All in the dialog; this will highlight (but not select) all instances.
You can select Reading Highlight > Highlight All in the dialog; this will highlight (but not select) all instances.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 612
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Search Based on Font
To clarify: The change you see in the text for found text in this process is not selecting it. It is something like temporary highlighting. Thus there is nothing selected to copy.BobH wrote: ↑15 Nov 2021, 21:30Thank you, Hans.
The process is working; however, when I find an instance and click on the found text which is highlighted and try to copy and paste it, nothing happens.
The document contains copious instances of the font. Is there a way to find all of them at once before copying and pasting?
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- Microsoft MVP
- Posts: 1318
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: Search Based on Font
Instead of clicking the Reading Highlight button, click the Find In button next to it. In the dropdown from that button, click Main Document. That does select -- rather than highlight -- all the found instances in the main document (not headers/footers [but there's a separate choice for that], text boxes, footnotes/endnotes, or anything else not in the main story range). Then copy/paste will work.
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- UraniumLounger
- Posts: 9274
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Re: Search Based on Font
Thanks, Jay!!!
That worked a treat. Is it possible that Word creates a macro from that sequence of choices? Or, is there a way that I can create a macro that does that?
That worked a treat. Is it possible that Word creates a macro from that sequence of choices? Or, is there a way that I can create a macro that does that?
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |
-
- Microsoft MVP
- Posts: 1318
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: Search Based on Font
Well, sort of. The nasty trick that makes it work is the much-maligned SendKeys command, which simulates pressing keys in the dialog. This macro selects all text in the document that has a font size of 16 points.
Code: Select all
Sub Macro1()
With Dialogs(wdDialogEditFind)
.Format = True
.Find = ""
SendKeys "%oF%s16~%i~": .Display
End With
End Sub
There are two problems with this. One is that the string has to be constructed specially for the exact formatting you want to find. Adding a userform to let you pick a format and convert that to the correct string would be a lot of work. The second problem is that the SendKeys command is much-maligned because it doesn't always work.
Another difficulty is this: Using the dialog manually, you can choose a style to search for, which would be preferable to searching for a specific direct formatting if the document uses styles as it should. However, the SendKeys string that ought to select a style from the secondary dialog fails miserably. Fortunately, the right-click menu in the Styles pane has a command to select all instances of the chosen style.
Last edited by Jay Freedman on 21 Nov 2021, 19:22, edited 1 time in total.
-
- UraniumLounger
- Posts: 9274
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Re: Search Based on Font
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |