#1
|
|||
|
|||
Is this even possible: extrapolating highlighted words
Hi everyone, I've been trying to find out Online whether or not Word has this capability, perhaps I'm not wording it right because I can't seem to find anything. If anyone knows, you guys will! Here's my situation: I am using Word to write pages and pages of notes for my coursework. I am constantly highlighting certain key terms and phrases that I need to study and/or memorize later. Is there any way I could somehow command Word to extrapolate from my notes only the words that are highlighted (or marked in some way)? that way I could quickly create a list of just those words/terms that I need to study. For example, if I bold those words, can I later command Word to take all words that are bold and copy them to the clipboard or something like that so that I can paste them somewhere else? What do you guys think? Thanks! |
#2
|
||||
|
||||
The following macro will put all the unique highlighted words or phrases into a new document each to a new line:
Code:
Sub ExtractWords() Dim oDoc As Document Dim oSource As Document Dim oRng As Range Dim Coll As Collection Dim i As Long Set oSource = ActiveDocument Set oRng = oSource.Range Set Coll = New Collection With oRng.Find .Highlight = True Do While .Execute On Error Resume Next Coll.Add oRng.Text, oRng.Text oRng.Collapse 0 Loop End With If Coll.Count > 0 Then Set oDoc = Documents.Add For i = 1 To Coll.Count oDoc.Range.InsertAfter Coll(i) & vbCr Next i End If lbl_Exit: Set oDoc = Nothing Set oSource = Nothing Set oRng = Nothing Set Coll = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Wow, thank you so much! Works like a charm. I really appreciate the help.
Cheers! |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters | Kalü | Word VBA | 22 | 04-24-2018 05:35 AM |
Highlighted folders | grjbyfleet | Outlook | 0 | 06-03-2017 01:07 AM |
How to mark underlined words in a sentence as A, B, C, D (beneath the words) | thudangky | Word | 13 | 12-12-2013 02:22 AM |
Why Words doesn’t show the style of the selected words automatically???? | Jamal NUMAN | Word | 0 | 04-14-2011 03:20 PM |