How to convert number to words in Word document?
This article is talking about the method on converting the numbers to English words in Word document, please go on to view the details if you are interested in.
1. Select the number you want to convert to words, press Alt + F11 keys to open Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and copy below codes and paste them to the Module script.
VBA: Convert number to words
Sub ConvertNumberToWord() 'UpdatebyExtendoffice20181010 Dim xDigit As Double Dim xBuff As String On Error Resume Next Selection.MoveLeft wdWord, 1, wdMove Selection.MoveRight wdWord, 1, wdExtend xDigit = Val(Trim(Selection.Text)) If xDigit = 0 And Str(xDigit) <> Trim(Selection.Text) Then Exit Sub If xDigit > 999999 Then If xDigit <= 999999999 Then xBuff = Trim(Int(Str(xDigit / 1000000))) Selection.Fields.Add Selection.Range, wdFieldEmpty, "= " + xBuff + " \* CardText", True Selection.MoveLeft wdWord, 1, wdExtend xBuff = Selection.Text & " million " xDigit = Right(Str(xDigit), 6) End If End If If xDigit <= 999999 Then Selection.Fields.Add Selection.Range, wdFieldEmpty, "= " + Str(xDigit) + " \* CardText", True Selection.MoveLeft wdWord, 1, wdExtend xDigit = xBuff & Selection.Text Selection.TypeText xDigit + " " Else MsgBox "Number too large", vbOKOnly, "Kutool for Word" End If End Sub
3. Press F5 key to run the code, now the number has been converted to words.
Note： The code only work at one number each time.
If you want to convert numbers to words in Excel sheet, there is a handy tool - Numbers to Words of Kutools for Excel, which can convert numbers to English or Chinese words, or convert numbers to English currency or Chinese currency.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the cells that you want to convert numbers to words, then click Kutools > Content > Numbers to Words.
2. In the popping dialog, check English and Not converted to Currency options.
3. Click Ok or Apply, the selected numbers will be converted to words.
Best Office Productivity Tools
Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!
Dive into the highlighted features below or click here to explore the full power of Kutools for Word.
➕ Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Diagonal Line Table / Equation Caption / Image Caption / Table Caption / Multiple Pictures / Discover more in our Insert Group
Transform your Word tasks with Kutools. 👉 Download with 30-day trial Now 🚀.