Find and replace question

G

Guest

Hi everybody,
I'm trying to write a macro that can find specific kinds of text, then put
specialized tags around them for a customized document parser I'm writing.

The four conditions I need to mark are left aligned/unformatted text, left
aligned/italic text, center aligned/unformatted text, and center
aligned/italic text. I've been practicing with find and replace so I can
record the macro, but I can't for the life of me figure out how to select a
specific kind of text, and then put the tags around it. I know how to select
font and paragraph formatting, so as an example, the kind of queries I've
been trying are like this (obviously it doesn't look the same because I can't
replicate the find/replace window, but you get the idea):

Find: *
(Format left aligned, regular text, use wildcards)

Replace: [L]/1[/L]

The "[L]" and "[/L]" are the tags I want to put around the text. This search
is the best I can come up with, and it just replaces all the text formatted
in the right way with alternating tags. Can anyone help me figure out what
the right replacing syntax would be?

Thanks a million!
Jezzica85
 
H

Herb Tyson [MVP]

Without wildcards enabled, specify ^& in the Replace field as the token for
matching text. For example [L]^&[\L].

^& means "whatever matched the search".
 
G

Guest

Thank you so much Herb, that works great!
Jezzica85

Herb Tyson said:
Without wildcards enabled, specify ^& in the Replace field as the token for
matching text. For example [L]^&[\L].

^& means "whatever matched the search".

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


jezzica85 said:
Hi everybody,
I'm trying to write a macro that can find specific kinds of text, then put
specialized tags around them for a customized document parser I'm writing.

The four conditions I need to mark are left aligned/unformatted text, left
aligned/italic text, center aligned/unformatted text, and center
aligned/italic text. I've been practicing with find and replace so I can
record the macro, but I can't for the life of me figure out how to select
a
specific kind of text, and then put the tags around it. I know how to
select
font and paragraph formatting, so as an example, the kind of queries I've
been trying are like this (obviously it doesn't look the same because I
can't
replicate the find/replace window, but you get the idea):

Find: *
(Format left aligned, regular text, use wildcards)

Replace: [L]/1[/L]

The "[L]" and "[/L]" are the tags I want to put around the text. This
search
is the best I can come up with, and it just replaces all the text
formatted
in the right way with alternating tags. Can anyone help me figure out what
the right replacing syntax would be?

Thanks a million!
Jezzica85
 

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