Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Automatic Non-breaking Spaces in Dates.

Automatic Non-breaking Spaces in Dates

Written by Allen Wyatt (last updated October 21, 2023)
This tip applies to Word 97, 2000, 2002, and 2003


When you enter a date into a document, it would be very handy for Word to automatically place a non-breaking space between the month and the day of the month. Thus, "January 22" would have a non-breaking space between the "y" and the "2". In this way, the month and day would always appear together on the same line.

Unfortunately, Word doesn't do this by default. This means that you have several different ways you can use Word's built-in tools to solve the situation.

The first possible solution is to try using Word's AutoCorrect feature. This feature is not well suited for doing this task, however. Why? Because AutoCorrect only kicks in after Word figures you are finished with a word—in other words, when you type the space after the word or some other terminating character, such as a punctuation mark. Thus, if you wanted to replace "January" with "January" followed by a non-breaking space, you would actually end up with two spaces after the word—the non-breaking space in the replacement text and the space you typed in the course of, well, typing.

This brings us to the next potential solution—AutoText. This solution actually can work very well, but it requires some differences in how you type dates. The best solution is to create 12 AutoText entries, each saved under the three-character name of the 12 months. Thus, the entry for "jan" would be "January" followed by a non-breaking space.

Why use three characters instead of more? Because Word has another feature called AutoComplete. (You see the control for this if you choose Tools | AutoCorrect | AutoText. It is the top check box on that tab.) If AutoComplete is turned on, then Word tries to "guess" what you are typing and suggest the rest of the word or phrase. It does this automatically for dates, but it doesn't kick in until you type the fourth character in a month that is longer than five characters. Thus, Word suggests "January" as a completion when you type "Janu", but it won't suggest "March" as a completion when you type "Marc".

If you use three characters for your month-and-non-breaking-space combination, then you can type "Jan" and press F3, resulting in the desired combination, without extra spaces. The change in how you type, of course, is that you must remember to only type three characters and then press F3.

If you don't like to remember such changes in how to type, you can easily create a macro that will go through a document and replace any spaces following a month name with a non-breaking space. The following is very handy for this purpose:

Sub MonthsWithNonBreakingSpaces()
    Dim sMonth As String
    Dim iMonth As Integer

    Selection.HomeKey unit:=wdStory
    For iMonth = 1 To 12
        With Selection.Find
            .ClearFormatting
            .Text = "(" & MonthName(iMonth, False) & ")( )([0-9])"
            .MatchWildcards = True
            With .Replacement
                .ClearFormatting
                .Text = "\1^s\3"
            End With
            .Execute Replace:=wdReplaceAll
        End With
    Next iMonth
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1749) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Automatic Non-breaking Spaces in Dates.

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

Cannot Open Multiple Word Documents

What are you to do if you try to open a document and Word automatically closes your previous document? Word is not ...

Discover More

Generating a List of Unique Words

Need to grab a list of unique words appearing in a document? You can tap the power of VBA's Words collection to perform ...

Discover More

Select One Cell and Make Another Cell Bold

Excel provides a number of different ways you can apply formatting to a cell based upon various dynamic conditions. One ...

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)

Capitals After Colons

Do you want Word to always capitalize the first letter appearing after a colon? The program won't do it by default, but ...

Discover More

Ensuring Consistent References with AutoText

You'll often need to make sure that references within a document are consistent with each other. In this tip you discover ...

Discover More

Extra Space after Quotation Mark when Pasting

Have you ever noticed how Word can decide to add extra spaces when you paste information into your document? This is part ...

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}] (all 7 characters, in the sequence shown) 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 nine minus 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

Videos
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.