The job is for a client who has Word 2000 and Word XP.
They want it to work on both versions.
They want to extract contact data from hundreds of word documents and all
such data has in common that it has been highlighted in some way - eg change
of font, bold, italics, change of colour etc. Anything that's not Normal
font has been tweaked by hand because the original data was "spat-out" by a
computer at some time in the last 5 years and would therefore have been
Normal style (or plain-text or body-text etc).
I haven't tried this yet but maybe I could store all the characteristics of
the paragraph style and then us Find to search for things like
eg something on the lines of ....
With Selection.Find.Font
.Color = Not(wdColorRed)
End With
With Selection.Find.Font
.Color <> wdColorRed
End With
I'm not sure if you can search for the absence of something.
Also there would probably be a LOT of properties to search for.
If after finding and extracting some text, I then reverted it to the default
paragraph font, then this would prevent it from being selected more than
once because it was bold AND italic AND green
Eddie
Hi Eddie,
> With Selection.Find.Font
> .Color = Not(wdColorRed)
[quoted text clipped - 3 lines]
> .Color <> wdColorRed
> End With
That won't work, I'm afraid. In your case, I'd probably try to figure out
all the "highlighting" that has been used (bold, italic, highlighted,
color=red, ...) and search for that. Assuming that bold, italic,
highlighted, color=red .... haven't been used in the styles, that is.
To find (or tag) arbitrary manual formatting will be more difficult.
The way I do it is to make a copy of the document where all paragraph styles
look like Normal style:
myStyle.Font = ActiveDocument.Styles(wdStyleNormal).Font
myStyle.ParagraphFormat =
ActiveDocument.Styles(wdStyleNormal).ParagraphFormat
For character styles:
myStyle.Font = ActiveDocument.Styles(wdStyleNormal).Font
A document that originally was formatted wholly with character styles and
paragraph styles will now look like plain unformatted text with those style
definitions.
Any remaining formatting that is still applied (italic, bold, space before,
...) has been applied manually.
You'll still need to search for all kinds of formatting separately, but at
least you won't match bold headings when searching for bold, and so on.
Greetings,
Klaus
> The job is for a client who has Word 2000 and Word XP.
> They want it to work on both versions.
[quoted text clipped - 31 lines]
>
> Eddie