金额大小写转换问题
text2的值为100 这个转换了显示 壹佰零拾零元 零角零分 怎么才能显示为壹佰元模块代码如下
程序代码:
Function RMBChinese(ByVal Rmb As Double) As String On Error Resume Next Dim Rmbexp As String, Rmbda As String, Expda As String, Lent As Integer, Ntyp As Integer, Icnt As Integer, i As Integer, Trmb As String Rmb = Format(Rmb, "###0.00") If Rmb > 999999999999.99 Then RMBChinese = "需转换的金额整数长度超过了12位!" Exit Function End If Rmbexp = "分角元拾佰仟万拾佰仟亿拾佰仟" Rmbda = "零壹贰叁肆伍陆柒捌玖" Ntyp = 0 Trmb = Replace(CStr(Format(Rmb, "0.00")), ".", "") If Left(Trmb, 1) = "-" Then Trmb = Mid(Trmb, 2) Ntyp = 1 End If Expda = "" Icnt = Len(Trmb) For i = 1 To Icnt Expda = Mid(Rmbda, Val(Mid(Trmb, Icnt - i + 1, 1)) + 1, 1) + IIf(Mid(Rmbexp, i, 1) = "元", Mid(Rmbexp, i, 1) + " ", Mid(Rmbexp, i, 1)) + Expda Next RMBChinese = IIf(Ntyp = 1, "负" + Expda, Expda) End Function