Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

How to tell word to spell out a number in digits

Posted on 2014-11-26
Last Modified: 2014-11-27
I have a very large amount of numbers in word that needs to be presented in both ways, numbers and spelled out. All the numbers are present in digits, but so far I need to type them manually to have them spelled out. Is there a way to automatically do this?
Question by:mvp1985
  • 3
  • 3
  • 2
  • +2
LVL 23

Expert Comment

ID: 40466630
There is no way to do it natively in word. You will have to use this macro.
LVL 14

Expert Comment

ID: 40466635
Open the VBA editor and put this into your document's or normal.dot macro code:

Sub Digits2Numbers()

    Dim digits As String
    Dim spelled As String
    digits = Selection.Text
    spelled = "#"
    For i = 1 To Len(digits)
        If i > 1 And Len(digits) > 1 Then spelled = spelled + "-"
        Select Case Mid(digits, i, 1)
        Case "0"
            spelled = spelled + "Zero"
        Case "1"
            spelled = spelled + "One"
        Case "2"
            spelled = spelled + "Two"
        Case "3"
            spelled = spelled + "Three"
        Case "4"
            spelled = spelled + "Four"
        Case "5"
            spelled = spelled + "Five"
        Case "6"
            spelled = spelled + "Six"
        Case "7"
            spelled = spelled + "Seven"
        Case "8"
            spelled = spelled + "Eight"
        Case "9"
            spelled = spelled + "Nine"
        Case "."
            spelled = spelled + "Dot"
        Case ","
            spelled = spelled + "Comma"
        Case "$"
            spelled = spelled + "Dollar"
        Case " "
            spelled = spelled + "Space"
        Case "-"
            spelled = spelled + "Minus"
        Case "+"
            spelled = spelled + "Plus"
        Case Else
            spelled = spelled + "???"
        End Select
    Next i
    spelled = spelled + "#"

    Dim objClipboard As Object
    Set objClipboard = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    objClipboard.SetText spelled
    Set objClipboard = Nothing
End Sub

Open in new window

Add the macro to your menu strip and/or assign a shortkey combination to it.


Type the number you want to convert, and select it. Run the macro. The converted number will be in the clipboart afterwards. To replace the number just type CRTL-V afterwards, since the number string is already selected. To use it elsewhere, just navigate to theright spot and press CTRL-V there.


     123456 78,90.5x+-

would return in the clipboard


For different start/end coding and separator just adjust the strings in the code ...

By the way that macro is independent to the number's length ... and with some more things in the select statement it could even be used tor translating text into a phonetic alphabet (Alpha, Bravo, Charlie, Delta, Echo, ... see here for more info).
LVL 23

Expert Comment

ID: 40466677
Experiment with this ....

Select a number in word (e.g. 2750)
Press Ctrl+F9 to embed it in a field.
Use Alt+F9 to show/hide the field as necessary.

Edit the field to match the following format:
{=VALUE \* CardText}      that is .... {=2750 \* CardText}

Press F9 to update the field.    Result = two thousand seven hundred fifty
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 76

Expert Comment

ID: 40466718
Missed your welcome later contribution.
LVL 23

Expert Comment

ID: 40466744
Point noted and taken on board GrahamSkan
LVL 21

Accepted Solution

EricFletcher earned 500 total points
ID: 40468426
Depending on how the numbers are presented, consider using the CardText formatting switch with in a field code.

For example, if your numbers were able to be referenced using MailMerge as, say, a variable names "Amount", you could use a field code with switches like this: {MERGEFIELD "Amount" \*CardText } to display a result like one thousand five hundred seventy-one (see image below)). Many formatting switches are available to manage how values are displayed with many of Word's field codes. See the Microsoft article here (Insert and format field codes in Word 2010; the same switches are available in older and newer versions).

The screen captures below show the merge codes first as seen in MailMerge; then as field codes (press Alt-f9 to toggle the view); and then as displayed when  the merged value of Amount was 1,570.76 (note the rounding in the CardText examples).
Field code switches to spell out numbersThe grey shading in the samples above identifies field codes and their results in the screen view (i.e. it won't be printed). This visibility is very useful to be able to detect content that is a result of a field code calculation amongst normal typed content. I always have it turned on: File Options > Advanced > Show document content, Field shading=Always.
LVL 21

Expert Comment

ID: 40468445
An addendum to my comment above: If you want to have the field code results converted to text instead of existing as calculated field codes, select the results and press Ctrl-Shift-F9. For the mail merge field codes, just run the "Finish & Merge" to produce a new document with the values.

Author Comment

ID: 40468743
The {MERGEFIELD "Amount" \*CardText } works perfect and is exactly what I need. But how can I assign the previous form field instead of "Amount"? This is important, since I run a macro on exiting the form field that has the number in digits, that unprotected the document, pastes a new page with the same form fields and text, and then re-protects the document.

Since the price is always different on each document page, but the formfield that contains the correct digits is always the one before the spelled out number, I know bookmarks would not work, unless there is a way to create a bookmark every time the makro runs upon exiting the price form field.
Any suggestions on this?
LVL 21

Expert Comment

ID: 40469113
I'm not sure I follow what you need to do here. Can you post an example?

The format switches will work with any field code that can return a numeric value, but you'd need to find away to refer to the value in some way with a field code. Perhaps the STYLEREF could be used if you can have the value from the formfield result tagged with a style as shown below.
Using STYLEREF to report a value as cardinal textFor clarity, I captured the 1st screen shot in the Draft mode so the paragraph style names would be shown in the style area pane on the left (File Options > Advanced > Display, Style area pane width in Draft and Outline views). The style pane will only show the style name associated with paragraphs, so I set the character style colour to brown to make it more visible. This can be handy for testing, and you can change the style's colour back to Auto once you know it works okay.

Author Comment

ID: 40469371
Basically I am developing a word document that is used for evaluations of art and jewelery for which i use form fields and text describing what goes into the form field. I do this so I can quickly enter the text and then just advance with the tab key. Since every customer is different, I don't know ho many items I need to evaluate, so I use a macro, which runs at the exit of the last form field on the page, that enters a page break, and the same form fields and descriptions (in order for this to work, the macro unprotects the document, and later protects it again, so I can use tab again).  The last item I enter is the estimated price of the piece, but for legal purposes I also need to enter it in non-numerical form right beneath the numerical form. (so for example:

 Estimated price: $40.00
                                 Forty US Dollar

The mergefield you mentioned earlier works perfectly when I enter the number into the "amount" when I establish the meregield. But, since I have often hundreds over hundreds of these prices, I would love for a way that it is automated completley, and all I need to do is put the numerical price in, and the non-numerical amount is automatically entered below. So yes, I need to find a way to refer to the numeric value somehow. Any suggestions on how to refer automatically?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question