Thread: [Solved] Extract Between the Parens
View Single Post
 
Old 11-15-2017, 06:10 PM
ChrisOK ChrisOK is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: Sep 2016
Posts: 54
ChrisOK is on a distinguished road
Default

Well, no errors -- seemed to run through without a hitch with one huge exception:
All content in the Word doc is gone. Not sure where it went.
I forgot to mention this was also occurring with the previous runs..
?

Would it help to use something like this to have it dump the results into a new docx?
(this was old code I used a long time ago to take something from one Word doc and dump it into a new doc)
Code:
Sub CopyHighlightedTextToADifferentDoc()
'THIS FINDS HIGHLIGHTED TEXT AND PLACES A COPY OF IT ON A SEPARATE NEW DOCUMENT IN LIST FORM FOR REVIEW
Dim ThisDoc As Document
Dim ThatDoc As Document
Dim r As Range
Set ThisDoc = ActiveDocument
Set r = ThisDoc.Range
Set ThatDoc = Documents.Add
With r.Find
.Text = ""
.Highlight = True
Do While .Execute(Forward:=True) = True
ThatDoc.Range.InsertAfter r.Text & vbCrLf
r.Collapse 0
Loop
End With
End Sub

'All highlighted text in the ActiveDocument are copied (with an added paragraph mark to separate them) to a new document.
Reply With Quote