Extracting Data in Word 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to have word Extract highlighted text in a Document and place
it in a new Word Document?

Thanks,
 
Or is it possible to tell word to extract any text that's already highlighted
in a document and paste it in a new document?

Thanks,
 
I don't see any difference in your two questions.

Try something like:

Sub ExtractHightlight()
Dim oRng As Word.Range
Dim oDoc2 As Word.Document
Dim i As Long
Set oRng = ActiveDocument.Range
Set oDoc2 = Documents.Add
i = 1
With oRng.Find
.Highlight = True
While .Execute
oDoc2.Range.InsertAfter "Extract " & i & ": " & oRng.Text & vbCr
i = i + 1
Wend
End With
oDoc2.Activate
End Sub
 
Well, the first question asked to highlight then extract text. The second
question asked to extract text that was already highlighted.

I appreciate the response and your code works well.

Thanks a bunch,
 
It depends on what you mean by "highlighted."

1. If you mean "selected," then the answer is easy: Just Copy and Paste.

2. If you mean colored with the Highlight tool, then this is almost as easy.

a. Ctrl+F to open the Find dialog.
b. Click More to expand the dialog.
c. Click Format and choose Highlight (leave the "Find what" box blank).
d. Check the box for "Highlight all items found."
e. Click Find All.
f. Click on the title bar of the document to return focus to the
document (do not close the Find dialog), and Ctrl+C to copy, then paste into
another document.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top