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.
Convert number to English words with VBA
Convert number to English words in Excel with Kutools for Excel
Convert number to English words with VBA
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.
Convert number to English words with Kutools for Excel
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.
๐ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/XLSX) / Batch Convert to PDF / Export Pages as Images / Print Multiple Files at once ...
โ Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text ...
๐งน Effortless Clean: Sweap away Extra Spaces / Section Breaks / All Headers / Text Boxes / Hyperlinks / For more removing tools, head to our Remove Group
โ 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
๐ Precision Selections: Pinpoint specific pages / tables / shapes / heading paragraphs / Navigate with ease using our Select Group
โญ Star Enhancements: Navigate swiftly to any location / auto-insert repetitive text / seamlessly toggle between document windows / 11 Conversion Tools ...
Transform your Word tasks with Kutools. ๐ Download with 30-day trial Now ๐.
