Setting Maximum Line Lengths in Word E-mail Messages

by Allen Wyatt
(last updated April 12, 2017)

1

Subscriber Reyzl Kalifowicz-Waletzky asked if there was a way, when using Word as an e-mail editor, to force line lengths so that they are no longer than 78 characters. Before responding, a little bit of a philosophical discussion may be in order...

There are two types of e-mail that are routinely sent over the Internet. The first type is text-only e-mail. This is the traditional type of e-mail, and text can be displayed by every e-mail client on the planet. If you are working with software (such as a mailing list manager) that expects each line of a message to have only a certain number of characters, it is a safe bet that it is expecting a text-only e-mail message.

The other type of e-mail people send is HTML e-mail. If you get messages that have pretty backgrounds, waving flags, different size type, and attributes such as bold or italic, then the message is an HTML e-mail. Even if the message only contains text, it is still an HTML e-mail. These types of messages use the same formatting codes that exist in Web pages in order to control how text appears in an e-mail client.

The problem is that not all e-mail clients can display HTML e-mail. If they can't display it, chances are they can't see your message. (This, again, is why some programs--such as a mailing list manager--may require text-only messages.) In addition, HTML e-mail messages are always larger than an equivalent text-only message because of the additional formatting information that is sent with the message.

Word, when used as an e-mail editor, is primarily used to create HTML messages. Unfortunately, there is no setting within Word that controls line length, because line length is not an issue with HTML messages. For this reason, if you need to create text-only e-mail messages, it is advisable to do so using a program designed specifically for that purpose. Most e-mail clients (including Outlook, Outlook Express, and Eudora) will create text-only e-mail messages just great. They will even allow you to specify a maximum line length.

If you must use Word as your e-mail client, then there are a couple of things you can do to approach the problem. One approach is to use a monospace font, set the margins so that there are a maximum of 78 characters per line, and then save the file using the Text Only With Line Breaks format. (If you are using Word 2002 or Word 2003, you should save the file using the MS-DOS Text With Layout format.)

Of course, following these steps gets you a file with the proper line length, but not an e-mail message with the proper line length. You would still need to find a way to get the file sent as an e-mail message. For instance, you could load the saved file back into Word and then send it.

Another approach you can use is to create a macro to split lines at the desired line length. The reason for the macro is that you must count actual characters on each line and then place a carriage return at or before the desired length. To complicate matters, the macro needs to make sure that it only breaks lines at the occurrence of a space. Fortunately, VBA allows you to examine words within a document, which automatically breaks at spaces. The following macro will break up a document into the desired line length.

Sub ForceTo78()
    Const cstrPunct As String = "!%*)}]:;>,."
    Dim rngChar As Range

    For Each rngChar In ActiveDocument.Words
        If rngChar.Information(wdFirstCharacterColumnNumber) > 77 Then
            If InStr(1, cstrPunct, Left(rngChar, 1), _
              vbTextCompare) = 0 Then rngChar.InsertParagraphBefore
        End If
    Next rngChar
End Sub

Notice that this macro breaks anything that is over 77 characters. The reason for this is quite simple: VBA, when it examines "words" in a document, considers a break to occur between a character and trailing punctuation. This macro simply examines the words returned, and if they begin with a punctuation mark, it ignores the word.

The bottom line is that the macro will correctly handle paragraphs in which a single punctuation mark appears at the 78th character position. However, if a valid word begins with a punctuation mark ( as in ".com") and that word falls at the 78th character position, then the macro will still ignore the word and allow it to stay on the line. This could, in rare instances, cause a line that is longer than 78 characters.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1572) applies to Microsoft Word 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Resizing Checkboxes

If you create a user form in VBA that includes checkboxes, you may want to make the checkboxes larger. You can't adjust their ...

Discover More

Inserting a Text Box

Many people use text boxes to help organize and layout information on the page. Here's how you can add text boxes to your ...

Discover More

WizTree

Need to find out which files are hogging the most space on your hard drives? The WizTree utility can analyze your drives very ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (menu)

Getting Rid of 'Mail To:' in E-mail Links

If you convert e-mail addresses to hyperlinks, you could end up with some 'mailto:' verbiage at the beginning of the links. ...

Discover More

Embedding TrueType Fonts in E-mails Composed in Word

When you use Word as your e-mail editor, it allows you to format the text of your e-mail messages using tools you are ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 6?

2012-11-08 06:10:37

Laerte Silva

Hi

Nice macro. I need something somewhat similar to it.

I need to ass "" to the end of every incomplete line (say, 75 or les characters), but not in tables.

Could you help me out with this macro?

Kind regards,


LJS


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.