Extract doc into text with 75 char line length

T

Terry

Does anhyone know of a VBA command that will take a Word doc paragraph and
convert it to (approx) 80n chars in width, while splitting the line at the
end of a word (ie, not to split at exactly 80 chars, but to split at the
last full word before the 80 chars is reached).

My problem is that we export the Word doc text into a database by extracting
the textual content (as ascii text) and the database app cannot present the
wider lines betyond 80 chars. I need to split the lines at the 80 (or less)
char mark and insert a CRLF so the db app can handle it for display.

Much appreciated.

Terry
 
J

Jay Freedman

Hi Terry,

You don't need a macro (although you can create one to automate the
following).

Select the text of the document. Apply Courier New font and 10 pt font
size. Because Courier New is a fixed-pitch font and the 10 pt size is
12 characters per inch, you can set the margins so the text column is
6.25 inches wide (for 75 characters max) or 6.5 inches wide (for 78
characters). Word's automatic line wrapping will make sure each line
ends with a full word.

Now select File > Save As, set the "Save as type" box to Plain Text,
supply a name, and click OK. You'll get another dialog where you
should check the box for "Insert line breaks" (keep the default of
"LF/CR") and click OK. Word will save the file as a text file with a
carriage return at the end of each line.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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