Parsing By Paragraph

A

Andrew Tegenkamp

I have an access database with a bunch of records and one field is a
paragraph. I can easily get that field into a VBA variable and place
it in their word template, but the client wants to be able to display
different paragraphs in the same variable/field to different locations
in a Word Doc.

Is there any way to parse out the different paragraphs? I have been
trying to base it on vbCr or vbLf but it's not very consistent. I know
about the paragraphs object (a little bit ~ mostly theory) but haven't
used it before so I'm not sure if I should go down that road in this
case.

Example:

strField = "Paragraph1!!Paragraph2!!Paragraph3!!Paragraph4" where ! is
a line return inside a single access field.

Thanks for any ideas,
Andrew
 
C

Cindy M -WordMVP-

Hi Andrew,

I'm afraid you have no choice than to use what ever character
combination has been entered in the Access field to separate the
paragraphs. As I recall, Access uses either Chr$(10)&Chr$(13) or the
other way around (13, then 10). Either way, Word doesn't usually
interpret this correctly, and you'd need to replace them with vbCR or
remove them completely.

To split something like this up, one usually uses the InStr method to
find the location of a specific character, then Mid to break it out of
the string.
I have an access database with a bunch of records and one field is a
paragraph. I can easily get that field into a VBA variable and place
it in their word template, but the client wants to be able to display
different paragraphs in the same variable/field to different locations
in a Word Doc.

Is there any way to parse out the different paragraphs? I have been
trying to base it on vbCr or vbLf but it's not very consistent. I know
about the paragraphs object (a little bit ~ mostly theory) but haven't
used it before so I'm not sure if I should go down that road in this
case.

Example:

strField = "Paragraph1!!Paragraph2!!Paragraph3!!Paragraph4" where ! is
a line return inside a single access field.

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 :)
 

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