word中如何将小写金额数字转换为大写
设置方法:1、输入所需要的阿拉伯数字,并选中;2、单击插入----编号按钮;3、弹出编号对话框,在编号类型列表中,选择"壹,贰,叁……"选项即可,如图所示;4、单击"确定"按钮,即可实现将阿拉伯数字转化为大写金额形式。
在word中如何将小写人民币转化为大写人民币?
第一步:打开word,输入所需要的阿拉伯数字。
第二步:选中输入的阿拉伯数字,并且在菜单栏中找到【插入】,在插入选项卡的"符号"选项组中单击【编号】按钮。
第三步:单击【编号】后,在【编号类型】列表中,选择【壹,贰,叁……】选项,单击【确定】按钮,即可实现将阿拉伯数字转化为大写金额形式。
WORD文件中数字大小写可否自动转换像EXCLE一样一个位置填写小...
第一招:釜底抽薪——自动更正法如果需要重复的输入一个大写数字金额,可以采用自动更正的方法。
例如要重复输入“肆仟叁佰伍拾元零伍分”,可以先输入“肆仟叁佰伍拾元零伍分”并选中它,然后执行菜单“工具→自动更正选项”打开“自动更正”对话框,在“替换”下的框内输入“4350.05”并单击“添加”按钮确定后退出,以后直接输入“4350.05”后回车即可快速得到“肆仟叁佰伍拾元零伍分”。
第二招:一劳永逸——编制自动宏如果有许多小写金额要变成大写的话,用上面的自动更正的方法需要定义很多自动更正项,显然也比较麻烦,其实只需要编辑一个宏就能做到“一劳永逸”了。
启动Word后按下A lt+F11组合键,在打开的工程窗口左侧双击“ThisDocument”进入代码编写窗口,在代码编辑窗口中输入如下代码:Option ExplicitSub 小写金额变大写() Dim Numeric As Currency, IntPart As Long, DecimalPart As Byte, MyField As Field, Lable As String Dim Jiao As Byte, Fen As Byte, Oddment As String, Odd As String, MyChinese As String Const ZWDX As String = "壹贰叁肆伍陆柒捌玖零" '定义一个中文大写汉字常量 On Error Resume Next '错误忽略 With Selection Numeric = VBA.Round(VBA.Val(.Text), 2) '四舍五入保留小数点后两位 '判断是否在表格中 If .Information(wdWithInTable) Then _.MoveRight unit:=wdCell Else .MoveRight unit:=wdCharacter '对数据进行判断,是否在指定的范围内 If VBA.Abs(Numeric) > 2147483647 Then MsgBox "数值超过范围!", _ vbOKOnly + vbExclamation, "Warning": Exit Sub IntPart = Int(VBA.Abs(Numeric)) '定义一个正整数 Odd = VBA.IIf(IntPart = 0, "", "圆") '定义一个STRING变量 '插入中文大写前的标签 Lable = VBA.IIf(Numeric = VBA.Abs(Numeric), "人民币金额大写: ", "人民币金额大写: 负") '对小数点后面二位数进行择定 DecimalPart = (VBA.Abs(Numeric) - IntPart) * 100 Select Case DecimalPart Case Is = 0 '如果是0,即是选定的数据为整数 Oddment = VBA.IIf(Odd = "", "", Odd & "整") Case Is "", "圆零" & VBA.Mid(ZWDX, DecimalPart, 1) & "分", _ VBA.Mid(ZWDX, DecimalPart, 1) & "分") Case 10, 20, 30, 40, 50, 60, 70, 80, 90 '如果是角整 Oddment = "圆" & VBA.Mid(ZWDX, DecimalPart / 10, 1) & "角整" Case Else '既有角,又有分的情况 Jiao = VBA.Left(CStr(DecimalPart), 1) '取得角面值 Fen = VBA.Right(CStr(DecimalPart), 1) '取得分面值 Oddment = Odd & VBA.Mid(ZWDX, Jiao, 1) & "角" '转换为角的中文大写 Oddment = Oddment & VBA.Mid(ZWDX, Fen, 1) & "分" '转换为分的中文大写 End Select '指定区域插入中文大写格式的域 Set MyField = .Fields.Add(Range:=.Range, Text:="= " & IntPart & " \*CHINESENUM2") MyField.Select '选定域(最后是用指定文本覆盖选定区域) '如果仅有角分情况下,Mychinese为"" MyChinese = VBA.IIf(MyField.Result "零", MyField.Result, "") .Text = Lable & MyChinese & Oddment End WithEnd Sub输入完毕后按下Alt+Q键返回word中,以后只需要依次选中需要转换的小写金额后,按下Alt+F8打开宏对话框,选择“小写金额变大写”宏,并单击“运行”即可快速地得出大写金额。
运行该宏可以在选定的文本数据后面插入此金额大写,如果选定范围在表格中,则在右侧单元格中插入金额大写。
132706.03元换成大写金额怎么写?
1)为ACCESS数据库新建一个“模块1”(已经有了可以免掉此步),在该模块下编写下列自定义公有大写转换函数Public Function SumInWordsRMB _(SumInFigures As Variant, Optional WithoutHeadRMB As Boolean) As StringDim a As Double, b As ByteDim Str As String, Strg As StringDim strInteger As StringDim strInt As StringDim strDecimalDim strDecmlDim Char As StringDim DigtWord As StringDim Pos As ByteDim i As Byte, Lns As Byte, iiDim canAddZero As BooleanDim AddZero As BooleanDim UseFullDigtWord As BooleanIf Not IsNumeric(SumInFigures) Then SumInWordsRMB = "" Exit FunctionElse a = CDbl(SumInFigures) If a 999999999999999# Then SumInWordsRMB = "" Exit Function End IfEnd IfPos = 0Strg = CStr(SumInFigures)For ii = 1 To Len(Strg) Char = Mid(Strg, ii, 1) If Char = "." Then Pos = ii If IsMissing(Str) Then Str = "0" Exit For End If If Char = "0" Then If AddZero = True Then Str = Str & Char Else Str = Str & Char AddZero = True End IfNext iiIf Pos > 0 And Mid(Strg, Pos + 1, 3) "" Then a = 0 b = 0 If Val(Mid(Strg, Pos + 3, 1)) >= 5 Then b = 1 b = b + Val(Mid(Strg, Pos + 2, 1)) b = 100 + Val(Mid(Strg, Pos + 1, 1)) * 10 + b If b >= 200 Then a = Str a = a + 1 Str = a End If If b 0 Then If Val(Right(b, 1)) > 0 Then Str = Str & "." & Mid(b, 2) Else If Val(Mid(b, 2, 1)) 0 Then Str = Str & "." & Mid(b, 2, 1) End If End IfEnd IfAddZero = FalseIf Str = "0" Or Str = "" Then If WithoutHeadRMB Then SumInWordsRMB = "零元整" Else SumInWordsRMB = "人民币零元整" End If Exit FunctionEnd IfStrg = ""For i = 1 To Len(Str) Select Case Mid(Str, i, 1) Case "0" Strg = Strg & "零" Case "1" Strg = Strg & "壹" Case "2" Strg = Strg & "贰" Case "3" Strg = Strg & "叁" Case "4" Strg = Strg & "肆" Case "5" Strg = Strg & "伍" Case "6" Strg = Strg & "陆" Case "7" Strg = Strg & "柒" Case "8" Strg = Strg & "捌" Case "9" Strg = Strg & "玖" Case "." Strg = Strg & "." End SelectNext iPos = 0Pos = InStr(1, Strg, ".", vbTextCompare)If Pos > 0 Then strInteger = Left(Strg, Pos - 1) strDecimal = Mid(Strg, Pos + 1)Else strInteger = StrgEnd IfIf strInteger = "零" Then strInt = ""Else strInteger = StrReverse(strInteger) Lns = Len(strInteger) For i = 1 To Lns Select Case i Case 1 DigtWord = "元" Case 2 DigtWord = "拾" Case 3 DigtWord = "佰" Case 4 DigtWord = "仟" Case 5 DigtWord = "万" Case 6 DigtWord = "拾万" Case 7 DigtWord = "佰万" Case 8 DigtWord = "仟万" Case 9 DigtWord = "亿" Case 10 DigtWord = "拾亿" Case 11 DigtWord = "佰亿" Case 12 DigtWord = "仟亿" Case 13 DigtWord = "万亿" Case 14 DigtWord = "拾万亿" Case 15 DigtWord = "佰万亿" End Select Char = Mid(strInteger, i, 1) If Char = "零" Then If i = 1 Then strInt = "元" UseFullDigtWord = True If canAddZero = True Then AddZero = True Else If UseFullDigtWord = True Then If AddZero = False Then strInt = Char & DigtWord & strInt Else If i >= 6 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If ElseIf i >= 10 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If ElseIf i >= 14 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If Else strInt = Char & DigtWord & "零" & strInt End If End If Else If AddZero = False Then strInt = Char & Left(DigtWord, 1) & strInt Else strInt = Char & Left(DigtWord, 1) & "零" & strInt End If End If canAddZero = True UseFullDigtWord = False AddZero = False End If Next iEnd IfIf Pos = 0 Then strDecml = "整"If Pos > 0 Then If Len(strDecimal) = 1 Then strDecml = strDecimal & "角整" If Len(strDecimal) = 2 Then If Left(strDecimal, 1) = "零" Then If strInt = "" Then strDecml = Right(strDecimal, 1) & "分" Else strDecml = "零" & Right(strDecimal, 1) & "分" End If Else strDecml = Left(strDecimal, 1) & "角" strDecml = strDecml & Right(strDecimal, 1) & "分" End If End IfEnd IfIf WithoutHeadRMB = False Then strInt = "人民币" & strIntEnd IfSumInWordsRMB = strInt & strDecmlEnd Function2)在ACCESS窗体里使用SumInWordsRMB函数。
每当在文本框TEXT1输入小写金额并回车或跳到其它控件时,文本框TEXT2会显示相应的人民币大写金额。
请于窗体设计窗口,文本框TEXT2内,填入公式"=SumInWordsRMB([TEXT1])" 即可实现。
有关代码中自定义函数的说明...
转载请注明出处51数据库 » word转换人民币金额大写