can a macro be set up to sense the end of a line of text?

  • Thread starter peter serratore
  • Start date
P

peter serratore

Hello all--

I have an old Word doc of names and addresses (not set up
as labels) that I'm trying to convert to a comma-
separated list so it can be mail-merged.

Can a macro be set up that's able to sense the end of a
line of text?

Right now, I have a small macro set up, that backspaces a
line and adds a comma. But I have to click the mouse to
bring it to the next line beginning, since all the lines
are of varying lengths. Then I kick in the small acro
again. It's tedious.

If I could set up such a macro, I can then have a macro
that re-formats the whole list, since the names and
addresses are all consistently four lines.

Thanks

-Peter
 
H

Helmut Weber

Hi Peter,
yes, but probably not necessary.
Selection.EndKey Unit:=wdLine
moves the cursor to the expected location.
If it is already there, the cursor vanishes,
at least on my screen, but it still there.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0
 
C

Cindy Meister -WordMVP-

Hi Peter,

How about using good old Find/Replace?

Find: ^p^p
Replace: +"*ç

Find: ^p
Replace: ,

Find: +"*ç
Replace: ^p

If this works, record it in a macro and you're all set...
I have an old Word doc of names and addresses (not set up
as labels) that I'm trying to convert to a comma-
separated list so it can be mail-merged.

Can a macro be set up that's able to sense the end of a
line of text?

Right now, I have a small macro set up, that backspaces a
line and adds a comma. But I have to click the mouse to
bring it to the next line beginning, since all the lines
are of varying lengths. Then I kick in the small acro
again. It's tedious.

If I could set up such a macro, I can then have a macro
that re-formats the whole list, since the names and
addresses are all consistently four lines.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
P

Peter Serratore

Hi--

Thanks for the reply.
Unfortunately, I don't know what all the symbols are that
you suggested for find/replace.
And I also don't what those symbol combinations add up
to. Could you tell me:sequence? And what does that sequence mean?

Thanks moochly,

-Peter
 
P

peter serratore

Hello-

Greetings from plain ol' Connecticut.

Thanks for the reply.

Could you elaborate on what the following sequence is
that you told me about:
Selection.EndKey Unit:=wdLine

What is "selection"
What is "endkey unit"?

and what is the remaining sequence?

I wonder if you're referring to a European keyboard,
which I found to be very different from a US keyboard (it
drove me nuts at an internet cafe in France!).

Thanks,

-Peter
 
K

Keith Miller

^p is a paragraph mark.

If each address has four lines and a blank line between each address, each address is separated by
two sequential paragraph marks (^p^p).

You first search for those breaks and use a 'placeholder' sequence: '+"*ç' (the c with the cedilla
is not required, any sequence that will not appear in your addresses will do)

The next search will replace the single paragraph marks between lines of the same address with
commas.

The final search will replace your 'placeholder' sequence with paragraph marks, giving you a
separate line for each address.

Keith

Hi--

Thanks for the reply.
Unfortunately, I don't know what all the symbols are that
you suggested for find/replace.
And I also don't what those symbol combinations add up
to. Could you tell me:sequence? And what does that sequence mean?

Thanks moochly,

-Peter
 

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