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: Converting Numbers to Text.

Converting Numbers to Text

Written by Allen Wyatt (last updated June 27, 2018)
This tip applies to Word 97, 2000, 2002, and 2003


1

There are times when you need to spell numbers out. For instance, you may want to spell out "1234" as "one thousand two hundred thirty-four." Word has no built-in function that will do the conversion for you, so you are left to create a macro that will handle the conversion.

The following macro, BigCardText, will convert any number between 0 and 999,999,999. To use it, simply place the insertion point either within the number you want to convert or just to the right of the number (if it is a single digit).

Sub BigCardText()
    Dim sDigits As String
    Dim sBigStuff As String

    sBigStuff = ""

    ' Select the full number in which the insertion point is located
    Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdMove
    Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend

    ' Store the digits in a variable
    sDigits = Trim(Selection.Text)

    If Val(sDigits) > 999999 Then
        If Val(sDigits) <= 999999999 Then
            sBigStuff = Trim(Int(Str(Val(sDigits) / 1000000)))
            ' Create a field containing the big digits and
            ' the cardtext format flag
            Selection.Fields.Add Range:=Selection.Range, _
              Type:=wdFieldEmpty, Text:="= " + sBigStuff + " \* CardText", _
              PreserveFormatting:=True

            ' Select the field and copy it
            Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
            sBigStuff = Selection.Text & " million "
            sDigits = Right(sDigits, 6)
        End If
    End If
    If Val(sDigits) <= 999999 Then
        ' Create a field containing the digits and the cardtext format flag
        Selection.Fields.Add Range:=Selection.Range, _
          Type:=wdFieldEmpty, Text:="= " + sDigits + " \* CardText", _
          PreserveFormatting:=True

        ' Select the field and copy it
        Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
        sDigits = sBigStuff & Selection.Text

        ' Now put the words in the document
        Selection.TypeText Text:=sDigits
        Selection.TypeText Text:=" "
    Else
        MsgBox "Number too large", vbOKOnly
    End If
End Sub

When using the macro, make sure that the number you are converting does not contain extraneous information, such as dollar signs or commas. When you run BigCardText, the macro checks to see if the selected number is over one million. If it is, it first works on the portion above one million, converting it to words. Then, the value below one million is converted. The final, full wording is put together and pasted back into the document, ready for use.

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 (203) 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: Converting Numbers to Text.

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

Displaying Quick Document Statistics

Need to see how many pages, words, paragraphs, or lines are in your document? Word makes it easy to retrieve such ...

Discover More

Changing Headers and Footers

Editing what is in your page header or footer is fairly easy, and you can use the same editing techniques you already ...

Discover More

Searching for Breaks

Word allows you to insert different types of breaks in your text that help control how your document is paginated. If you ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (menu)

Determining if Caps Lock is On

If your macro needs to determine the status of the Caps Lock key, you need the code in this tip. Just use the Information ...

Discover More

Changing the Default Drive

Macros can be used to read and write all sorts of files. If those files are on a different drive than the current one, ...

Discover More

Inserting a Break with a Macro

Inserting a break in your document is easy. You may think that inserting one using a macro is more complex, but it isn't. ...

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 seven more than 1?

2021-05-29 06:57:24

Igi

Thank you!!!!
This is exactly what i was looking for.
:)


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.