Personal website of Gregory K. Maxey, Commander USN (Retired)
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
This this Microsoft Word Tips & Microsoft Word Help page illustrates several basic methods that you can use to spell out a numerical currency value as text and provides a comprehensive Word template add-in for this purpose co-developed with Word MVP Graham Mayor.
The simplest method is using a field. The currency value that is spelled out in this fanciful check draft was created with a REF field and two formatting switches "DollarText" and "FirstCap."
To employ this method I used an online (protected) text formfield for the numerical input. I named this formfield "Amount" to match the REF field used.
Unfortunately there is a limit to the size numeral that \* DollarText will format. The limit is $100,000.00.
What if some munificent Word user wished to contribute $1,000,000.00 or more to support my budding website??!
I am prepared to oblige. Word MVP Doug Robbins and I have collaborated and put together some VBA code to spell out currency values as large $9,999,999,999.00.
At one time that was enough to cover the burgeoning U.S. National Debt with plenty left over for me and Doug. Now we will have to do without.
The code for this process is lengthy and involves several called functions. To use this method:
Option Explicit Sub NumToText() Dim sngNumber As Single On Error Goto Err_Handler sngNumber = ActiveDocument.FormFields("NumberAmount").Result If IsNumeric(sngNumber) And Val(sngNumber) < "10000000000000" Then ActiveDocument.FormFields("TextAmount").Result = _ ConvertCurrencyToEnglish(ByVal sngNumber) Else ActiveDocument.FormFields("TextAmount").Result = "Exceeds value limit" End If Exit Sub Err_Hanndler: ActiveDocument.FormFields("NumberAmount").Result = "0.00" ActiveDocument.FormFields("TextAmount2).Result = "" End Sub Function ConvertCurrencyToEnglish(ByVal sngNumber) Dim strTemp As String, strDollars As String, strCents As String Dim lngDecimal As Long, lngCount As Long ReDim Place(9) As String Place(2) = "thousand " Place(3) = "million " Place(4) = "billion " Place(5) = "trillion " sngNumber = Trim(Str(sngNumber)) lngDecimal = InStr(sngNumber, ".") If lngDecimal > 0 Then strTemp = Left(Mid(sngNumber, lngDecimal + 1) & "00", 2) strCents = ConvertTens(sngNumber, strTemp) sngNumber = Trim(Left(sngNumber, lngDecimal - 1)) End If lngCount = 1 Do While sngNumber <> "" 'convert last 3 digits to strDollars strTemp = ConvertHundreds(Right(sngNumber, 3)) If strTemp <;> "" Then strDollars = strTemp & Place(lngCount) & strDollars If Len(sngNumber) > 3 Then 'remove last 3 converted digits sngNumber = Left(sngNumber, Len(sngNumber) - 3) Else sngNumber = "" End If lngCount = lngCount + 1 Loop 'clean up strDollars Select Case strDollars Case "" strDollars = "" Case "One " strDollars = "One Dollar" Case Else strDollars = strDollars & "dollars" End Select 'clean up strCents If strDollars = "" Then Select Case strCents Case "" strCents = "" Case "One " strCents = "One Cent" Case Else strCents = strCents & "Cents" End Select Else Select Case strCents Case "" strCents = "" Case "One" strCents = " And One Cent" Case "One " strCents = " And One Cent" Case Else strCents = " And " & strCents & "cents" End Select End If If strDollars = "" And strCents = "" Then ConvertCurrencyToEnglish = "Zero" Else strTemp = strDollars & strCents strTemp = UCase(Left(strTemp, 1)) & _ LCase(Mid(strTemp, 2, Len(strTemp) - 1)) ConvertCurrencyToEnglish = strTemp End If lbl_Exit: Exit Function End Function Private Function ConvertHundreds(ByVal sngNumber) Dim Result As String If Val(sngNumber) = 0 Then Exit Function 'append leading zeros to number sngNumber = Right("000" & sngNumber, 3) 'do we have hundreds place digit to convert? If Left(sngNumber, 1) <;> "0" Then Result = ConvertDigit(Left(sngNumber, 1)) & "hundred " End If 'do we have tens place digit to convert? If Mid(sngNumber, 2, 1) <;> "0" Then Result = Result & ConvertTens(sngNumber, Mid(sngNumber, 2)) Else 'if not, then convert the ones place digit Result = Result & ConvertDigit(Mid(sngNumber, 3)) End If ConvertHundreds = Trim(Result) & " " lbl_Exit: Exit Function End Function Private Function ConvertTens(ByVal sngNumber, ByVal MyTens) Dim Result As String 'is value between 10 and 19? If Val(Left(MyTens, 1)) = 1 Then Select Case Val(MyTens) Case 10: Result = "Ten " Case 11: Result = "Eleven " Case 12: Result = "Twelve " Case 13: Result = "Thirteen " Case 14: Result = "Fourteen " Case 15: Result = "Fifteen " Case 16: Result = "Sixteen " Case 17: Result = "Seventeen " Case 18: Result = "Eighteen " Case 19: Result = "Nineteen " Case Else End Select Else Select Case Val(Left(MyTens, 1)) Case 2: Result = "Twenty " Case 3: Result = "Thirty " Case 4: Result = "Forty " Case 5: Result = "Fifty " Case 6: Result = "Sixty " Case 7: Result = "Seventy " Case 8: Result = "Eighty " Case 9: Result = "Ninety " Case Else End Select 'convert ones place digit If Result <;> "" Then If Mid(sngNumber, 3, 1) <;> "0" Or Right(MyTens, 1) <;> "0" Then Result = Left(Result, Len(Result) - 1) & "-" _ & ConvertDigit(Right(MyTens, 1)) End If Else Result = Result & ConvertDigit(Right(MyTens, 1)) End If End If ConvertTens = Result lbl_Exit: Exit Function End Function Private Function ConvertDigit(ByVal MyDigit) Select Case Val(MyDigit) Case 1: ConvertDigit = "One " Case 2: ConvertDigit = "Two " Case 3: ConvertDigit = "Three " Case 4: ConvertDigit = "Four " Case 5: ConvertDigit = "Five " Case 6: ConvertDigit = "Six " Case 7: ConvertDigit = "Seven " Case 8: ConvertDigit = "Eight " Case 9: ConvertDigit = "Nine " Case Else: ConvertDigit = "" End Select lbl_Exit: Exit Function End Function
Results of numerical currency values entered in the first formfield are spelled out in the second formfield as shown.
Note: If you prefer the cents to be shown fractional rather than spelled out then you can use an alternate procedure located in the standard module modAlt in the demonstration document: Spell Out Currency
Leveraging the code illustrated above, Word MVP Graham Mayor and I began collaborating on a Word template add-in which you can use to insert fully spelled out currency values in your Word documents. Not so much the tinkerer as I, Graham has published a compact version of this add-in on his website: Display Currency Values in Words. He continued to provide suggestions and feedback as I continued to "polish the cannon ball."
With the user configurable settings, you can insert currency figures as text in a full range of currencies and formats. The add-in default configuration settings are displayed when the add-in is first used. These settings are are shown in Figures 1 and 2 above.
Figure 3 illustrates the check template feature introduced with version 2.1.
Currency data for any world currency is configurable and can be defined in the add-in Currency Information table. The default Currency Information table is shown below. To access the Currency Information table or review full instructions for using the add-in, open the template add-in template file in Word.
After editing the Currency Information table, save the template file, close Word, restart Word and reload the add-in.
The add-in is available in both .dot (Word 2003) and .dotm (Word 2007/2010/2013) versions. The user interface control for the two versions is shown below.
In the following illustrations, I have typed in a number, initiated the add-in, applied settings suitable for a formal international contract, and then clicked "Process Input."
The image below illustrates a sample check template for use with the add-in. The template defines five (5) required bookmarks placed in frames and must be precisely positioned to print in the proper location on pre-printed check stock. The template is included in the add-in download package. You can easily open the sample template in Word and then copy and paste the frames and bookmarks to your own custom template.
Most users are expected to consistently use the same configuration settings. After applying your settings and processing your first number, you can process any additional numbers that you type or select automatically, without displaying the dialog, by simply applying the add-in auto process shortcut CTRL+SHIFT+$.
You can download the my template zip package containing both .dot and .dotm versions of the add-in here: Number to Currency as Text
See: Installing Macros for instructions on how to set up and use the macros and template add-in provided in this Microsoft Word Help & Microsoft Word Tips page.
That's it! I hope you have found this tips page useful and informative.
Do you want to make a payment for consulting work or donate to help support this site?
PayPal is a safe, easy way to pay online.
Use the appropriate currency "Donate" button to make a payment or donation.