Hi group,

my problem (Word 2003):

I have to identify all numbers that are at the beginning of a paragraph
in a word document but are *not* headings and put a marker (like
"xyzxyz") in front of the number (to prevent that any numeric character
that does not belong to a heading will ever stand at the beginning of a
paragraph; this is important for further scripting/conversion in this
case).

Headings (which shall *not* get a marker) are numbered 1., 1.1, 1.2,
2., 3., 3.1, 3.2, 3.2.1, 3.2.2, 3.3, 4. etc.

There are probably no numbers >99 in Headings (so no three-digit
numbers between periods in heading numbering), but at the beginning of
paragraphs there may be numbers that have (a) periods as thousands
separators, as these are German documents and (b) dates, which are
written "xx.xx.xxxx" here, with or without spaces.
both kinds of numbers should be treated like all other non-heading
numbers (put a marker before the first digit at the beginning of the
paragraph).

I can't use paragraph styles for identification, because they're not
reliably there.

All this should be done by a macro.
Actually, I don't have a clue about VBA, but I can copy/paste, and I
have to solve this - fast!

Can someone help?

TIA
Alex

Re: Identify and mark numbers at the beginning of paragraphs - but not headings by Doug

Doug
Sun Oct 29 14:51:28 CST 2006

See the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Alex Wenzel" <awusenetSPAMBLOKK@arcor.de> wrote in message
news:1162154809.581190.239100@i42g2000cwa.googlegroups.com...
> Hi group,
>
> my problem (Word 2003):
>
> I have to identify all numbers that are at the beginning of a paragraph
> in a word document but are *not* headings and put a marker (like
> "xyzxyz") in front of the number (to prevent that any numeric character
> that does not belong to a heading will ever stand at the beginning of a
> paragraph; this is important for further scripting/conversion in this
> case).
>
> Headings (which shall *not* get a marker) are numbered 1., 1.1, 1.2,
> 2., 3., 3.1, 3.2, 3.2.1, 3.2.2, 3.3, 4. etc.
>
> There are probably no numbers >99 in Headings (so no three-digit
> numbers between periods in heading numbering), but at the beginning of
> paragraphs there may be numbers that have (a) periods as thousands
> separators, as these are German documents and (b) dates, which are
> written "xx.xx.xxxx" here, with or without spaces.
> both kinds of numbers should be treated like all other non-heading
> numbers (put a marker before the first digit at the beginning of the
> paragraph).
>
> I can't use paragraph styles for identification, because they're not
> reliably there.
>
> All this should be done by a macro.
> Actually, I don't have a clue about VBA, but I can copy/paste, and I
> have to solve this - fast!
>
> Can someone help?
>
> TIA
> Alex
>



Re: Identify and mark numbers at the beginning of paragraphs - but not headings by Alex

Alex
Sun Oct 29 17:37:30 CST 2006

Doug Robbins - Word MVP wrote:
> See the article "Finding and replacing characters using wildcards" at:
>
> http://www.word.mvps.org/FAQs/General/UsingWildcards.htm

Thanks, this article helped me to find out how to do this by
search/replace - in five turns...

A.) Mark Headings
1st Level:
Search: (^13)([0-9]{1;2}).([!0-9])
Replace all: \1XXX\2.\3
2nd Level:
Search: (^13)([0-9]{1;2}).([0-9]{1;2})([!.0-9])
Replace all: \1XXX\2.\3\4
3rd Level (and subsequent levels):
Search: (^13)([0-9]{1;2}).([0-9]{1;2}).([0-9]{1;2})([!0-9])
Replace all: \1XXX\2.\3.\4\5

B.) Mark all other numbers at the beginning of paragraphs
Search: (^13)([0-9])
Replace all: \1YYY\2

C.) Revert A.
Search: (^13)(XXX)([0-9])
Replace all: \1\3

(Note that these statements are with semicolons instead of commas
because it is a German version).

This looks like a lot of work. How to combine that into a macro (and
hopefully also catch numbers in tables, which these search-replace
passes seem not to do)?