首页 [整理版]用于将数字换汉字大写数字的函数

[整理版]用于将数字换汉字大写数字的函数

举报
开通vip

[整理版]用于将数字换汉字大写数字的函数[整理版]用于将数字换汉字大写数字的函数 用于将数字换汉字大写数字的函数 Function zhh(mrmbze) Dim S_1 As String Dim S_2 As String Dim S_4 As String Dim s_5 As String Dim S_6 As String Dim S_7 As String Dim I As Integer Dim tn As Single S_1 = "零壹贰叁肆伍陆柒捌玖" S_2 = "仟佰拾万仟佰拾元角分" 转自,Access中...

[整理版]用于将数字换汉字大写数字的函数
[整理版]用于将数字换汉字大写数字的函数 用于将数字换汉字大写数字的函数 Function zhh(mrmbze) Dim S_1 As String Dim S_2 As String Dim S_4 As String Dim s_5 As String Dim S_6 As String Dim S_7 As String Dim I As Integer Dim tn As Single S_1 = "零壹贰叁肆伍陆柒捌玖" S_2 = "仟佰拾万仟佰拾元角分" 转自,Access中国 作者,Benjamin_luk 代码, Option Compare Database Option Explicit Function CWord(myNumber As Double) As String Dim str1 As String, str2 As String, str3 As String, str4 As String, str5 As String, str6 As String, str7 As String Dim I As Integer, J As Integer, K As Integer, L As Integer str1 = "仟佰拾亿仟佰拾万仟佰拾元角分" str2 = "元角分" str3 = "零壹贰叁肆伍陆柒捌玖" str4 = Left(Trim(Format(myNumber, "0.00")), Len(Format(myNumber, "0. 00")) - 3) & Right(Trim(Format(myNumber, "0.00")), 2) str5 = Right(Trim(Format(myNumber, "0.00")), 2) str6 = Right(str1, Len(str4)) For I = 1 To Len(str4) K = CDbl(Mid(str4, I, 1)) str7 = str7 & Mid(str3, K + 1, 1) & Mid(str6, I, 1) Next I CWord = str7 & "整" End Function Function ctest() MsgBox CWord(120001.03) End Function S_4 = Ltrim(Str(Nz(Int(mrmbze * 100)))) If Len(S_4) > 10 And mrmbze > 0 And mrmbze < 99999999.99 Then tn = Int(mrmbze * 100) / 100 If mrmbze - tn >= 0.005 Then tn = tn + 0.01 End If S_4 = Ltrim(Str(tn * 100)) End If If Len(S_4) > 10 Or mrmbze < 0 Then zhh = "ERROR!!! The number to be transferred CANNOT be negative an d must be less than 99999999.99" Else S_4 = String(10 - Len(S_4), " ") + S_4 I = 1 zhh = "" Do While I <= 10 s_5 = Mid(S_4, I, 1) If s_5 <> " " Then S_6 = Mid(S_1, Val(s_5) + 1, 1) S_7 = Mid(S_2, I, 1) If s_5 = "0" And I <> 4 And I <> 8 Then S_7 = "" End If If (Mid(S_4, I, 2) = "00") Or (s_5 = "0" And (I = 4 Or I = 8 Or I = 10)) Then S_6 = "" End If zhh = zhh + S_6 + S_7 If Mid(S_4, I, 1) = "0" And Mid(S_4, I + 1, 1) <> "0" And (I = 4 Or I = 8) Then zhh = zhh + "零" End If End If I = I + 1 Loop If s_5 = "0" Then zhh = zhh + "整" End If End If If zhh Like "*" & "元零" & "*" & "角" & "*" Then zhh = Replace(zhh, "元零", "元") End If End Function
本文档为【[整理版]用于将数字换汉字大写数字的函数】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_654168
暂无简介~
格式:doc
大小:15KB
软件:Word
页数:0
分类:生活休闲
上传时间:2017-11-21
浏览量:12