简洁的人民币大写转换函数
时间:2008-12-30 16:47 来源:网络 作者:gdjdyyj 阅读:次
Public Function rmbdx(je As Currency)
Dim f As String, g As String, a As String, b As String
Dim l As Integer, zl As Integer, z As Integer, v As Integer
f = "壹贰叁肆伍陆柒捌玖"
g = "元万亿万拾佰仟分角"
jns = LTrim(CStr(Format(je, "###0.00")))
l = Len(jns)
zl = Len(jns)
a = ""
b = ""
Do While l > 0
z = Val(Mid(jns, zl + 1 - l, 1))
v = l Mod 4
u = Int(l / 4)
If z > 0 Then
a = a + b + Mid(f, z, 1) + Mid(g, IIf(v = 0, u, v + IIf(u > 0, 4, 7)), 1)
b = ""
Else
a = a + IIf(l = 1, "整", IIf(v = 0, IIf(zl <> 4, Mid(g, IIf(u = 0, u + 1, u), 1), ""), ""))
b = IIf(v > 0, "零", "")
End If
l = IIf(l = 4, 2, l - 1)
Loop
rmbdx = IIf(RightB(a, 8) = "亿万元整", Mid(a, 1, Len(a) - 3) & Right(a, 2), a)
End Function
(责任编辑:admin)
顶一下
(1)
100%
踩一下
(0)
0%
相关内容
- ·关于 Partition 函数在分组查询中的应
- ·Access算术运算符的含义和说明表
- ·mid函数的另类用法
- ·access制作程序运行进度框
- ·Function与Sub的异同(函数调用)
- ·Access判断某个数值是否为某个数据类型
- ·select case后面语句块的值的四种格式
- ·vba条件语句的两种表示方法
- ·Access几种数据类型初始化的值
- ·Access vba null与""空字符串的区别
- ·access vba 数据类型表
- ·Access变量的命名规则
- ·Access中EXIT Sub与End Sub的区别
- ·Access vba中参数前关键字ByRef和ByVal
- ·Access列表框快速全选的技巧【最快】
- ·vba函数的数据类型强制转换
最新内容
推荐内容