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.
Recommended Word Productivity Tools
Kutools For Word - More Than 100 Advanced Features For Word, Save Your 50% Time
- Complicated and repeated operations can be done one-time processing in seconds.
- Insert multiple images across folders into Word document at once.
- Merge and combine multiple Word files across folders into one with your desired order.
- Split the current document into separate documents according to heading, section break or other criteria.
- Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...