跳至主要内容

如何在Word文档中将数字转换为英文单词?

Author: Sun Last Modified: 2025-05-07

本文介绍了一种在Word文档中将数字转换为英文单词的方法,如果您感兴趣,请继续查看详细信息。

使用VBA将数字转换为英文单词

使用Kutools for Excel在Excel中将数字转换为英文单词


使用VBA将数字转换为英文单词

1. 选择要转换为单词的数字,按 Alt + F11 键打开 Microsoft Visual Basic for Applications 窗口。

2. 单击 插入 > 模块,并复制以下代码,将其粘贴到模块脚本中。

VBA:将数字转换为单词

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. 按 F5 键运行代码,现在数字已被转换为单词。
Number converted to English words

备注:该代码每次只能处理一个数字。


使用Kutools for Excel将数字转换为英文单词

如果要在Excel工作表中将数字转换为单词,可以使用Kutools for Excel中的 小写金额转大写 工具,它可以将数字转换为英文或中文单词,或者将数字转换为英文货币或中文货币。

Kutools for Excel配备 AI 🤖,提供超过 300 项实用功能,简化您的任务。

免费安装 Kutools for Excel 后,请按照以下步骤操作:

1. 选择要将数字转换为单词的单元格,然后单击 Kutools > 文本 > 小写金额转大写.
Numbers to Words option on the Kutools tab on the Excel ribbon

2. 在弹出的对话框中,勾选 英语不转换为货币 选项。
Numbers to Words dialog box

3. 单击 确定应用,所选数字将被转换为单词。

最佳办公生产力工具

Kutools for Word - 通过超过 100 个卓越功能提升您的 Word 体验!

🤖 Kutools AI 功能AI助手 / 实时助手 / 超级润色(保留格式)/ 超级翻译(保留格式)/ AI遮挡 / AI校正...

📘 文档精通拆分页面 / 合并文档 / 以多种格式导出选择内容(PDF/TXT/DOC/HTML...)/ 批量转换为 PDF...

内容编辑跨多个文件批量查找和替换 / 调整所有图片大小 / 翻转表格的行和列 / 表格转文本...

🧹 轻松清理:清除多余空格 / 分节符 / 文本框 / 超链接 / 更多清理工具,请前往“清除”组...

创意插入:插入千位分隔符 / 复选框 / 单选按钮 / 二维码 / 条形码 / 多张图片 / 在“插入 ”组中发现更多...

🔍 精确选择:定位特定页面 / 表格 / 形状 / 标题段落 / 使用更多 选择 功能增强导航...

星级增强功能跳转到任意位置 / 自动插入重复文本 / 在文档窗口之间切换 / 11 转换 工具...

Kutools and Kutools Plus tabs on the Word Ribbon
👉 想尝试这些功能吗?立即下载 Kutools for Word!🚀
 

最佳办公生产力工具

Kutools for Word - 100+ Word 工具