Mark text of document for extraction

M

Mike

Have a large documnt about 6700 pages long, am basically trying to figure out
a way to extract certain pieces of info out. I have tried Finding the text
and copying it to another document, which works for a while, but it is too
large, and crashes eventually. I have tried Finding the text, and marking it
with special characters, thinking I could then sort the document, but it says
the document is too large for sorting. Does anyone have any ideas?
 
D

Dave Lett

Hi Mike,

You mentioned that you could find the material and copy to another document.
Well, can you find the material and assign it a style without crashing the
document. If so, then you can use something like the following to strip out
all of the styles except for the style you apply to the material you want to
extract:

Dim oStyl As Style
Selection.HomeKey Unit:=wdStory
For Each oStyl In ActiveDocument.Styles
If oStyl.InUse Then
If oStyl.NameLocal <> "ExtractMaterial" And _
oStyl.NameLocal <> "Default Paragraph Font" Then
Debug.Print oStyl.NameLocal
With Selection.Find
.ClearFormatting
.Style = oStyl.NameLocal
With .Replacement
.ClearFormatting
End With
.Execute Replace:=wdReplaceAll
End With
End If
End If
Next oStyl

HTH,
Dave
 

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

Top