各位大哥:
    新年好!
    小弟在这里向各位拜年了!
    今小弟有一问题请教各位大哥
    在作一个财务软件的时候遇到一个问题,就是在输入金额的时候,如何将输入的阿拉伯数字转化为中文的大写数字? 例如:1225 ---〉 壹仟贰佰贰拾五圆整;12.25 --〉壹拾贰圆贰角四分
    谢谢!!

解决方案 »

  1.   

    http://search.csdn.net/Expert/topic/810/810633.xml?temp=.1376764
    http://search.csdn.net/Expert/topic/822/822698.xml?temp=.6215631
      

  2.   

    http://search.csdn.net/Expert/topic/1706/1706921.xml?temp=.8668329
    http://search.csdn.net/Expert/topic/1482/1482777.xml?temp=.605694
    http://search.csdn.net/Expert/topic/2598/2598469.xml?temp=.2482263
      

  3.   

    给你个完整模块,完全合乎你的要求.
    模块名称:mGetChinese
    模块代码:Option ExplicitDim Num_To_Chinese(10) As StringPrivate Sub Init_Chinese()
        Num_To_Chinese(0) = "Áã"
        Num_To_Chinese(1) = "Ò¼"
        Num_To_Chinese(2) = "·¡"
        Num_To_Chinese(3) = "Èþ"
        Num_To_Chinese(4) = "ËÁ"
        Num_To_Chinese(5) = "Îé"
        Num_To_Chinese(6) = "½"
        Num_To_Chinese(7) = "Æâ"
        Num_To_Chinese(8) = "°Æ"
        Num_To_Chinese(9) = "¾Á"
    End SubPublic Function GetChineseString(ByVal m As Currency) As String
        Dim Pre As Integer
        Dim Had_Frist_Num As Boolean
        Dim temp As String
        Call Init_Chinese
        Pre = 0
    re:
        Select Case m
            Case Is >= 10000000 And m < 100000000
                Had_Frist_Num = True
                temp = Num_To_Chinese(Int(m / 10000000)) & "&Ccedil;§"
                Pre = 1
                m = m - Int(m / 10000000) * 10000000
                GoTo re
            Case Is >= 1000000 And m < 10000000
                Had_Frist_Num = True
                temp = temp & Num_To_Chinese(Int(m / 1000000)) & "°&Ugrave;"
                Pre = 2
                m = m - Int(m / 1000000) * 1000000
                GoTo re
            Case Is >= 100000 And m < 1000000
                If Not Had_Frist_Num Then
                   temp = Num_To_Chinese(Int(m / 100000)) & "&Ecirc;°"
                ElseIf Pre <> 2 Then
                    temp = temp & "&Aacute;&atilde;" & Num_To_Chinese(Int(m / 100000)) & "&Ecirc;°"
                Else
                    temp = temp & Num_To_Chinese(Int(m / 100000)) & "&Ecirc;°"
                End If
                Had_Frist_Num = True
                Pre = 3
                m = m - Int(m / 100000) * 100000
                GoTo re
            Case Is >= 10000 And m < 100000
                If Not Had_Frist_Num Then
                   temp = Num_To_Chinese(Int(m / 10000)) & "&Iacute;ò"
                ElseIf Pre <> 3 Then
                   temp = temp & "&Aacute;&atilde;" & Num_To_Chinese(Int(m / 10000)) & "&Iacute;ò"
                Else
                   temp = temp & Num_To_Chinese(Int(m / 10000)) & "&Iacute;ò"
                End If
                Had_Frist_Num = True
                Pre = 4
                m = m - Int(m / 10000) * 10000
                GoTo re
          Case Is >= 1000 And m < 10000
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 1000)) & "&Ccedil;§"
                ElseIf Pre <> 4 Then
                   temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m / 1000)) & "&Ccedil;§"
                Else
                   temp = temp & Num_To_Chinese(Int(m / 1000)) & "&Ccedil;§"
                End If
                Had_Frist_Num = True
                Pre = 5
                m = m - Int(m / 1000) * 1000
                GoTo re
           Case Is >= 100 And m < 1000
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 100)) & "°&Ugrave;"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m / 100)) & "°&Ugrave;"
                ElseIf Pre <> 5 Then
                   temp = temp & "&Aacute;&atilde;" & Num_To_Chinese(Int(m / 100)) & "°&Ugrave;"
                Else
                temp = temp & Num_To_Chinese(Int(m / 100)) & "°&Ugrave;"
                End If
                Had_Frist_Num = True
                Pre = 6
                m = m - Int(m / 100) * 100
                GoTo re
          Case Is >= 10 And m < 100
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 10)) & "&Ecirc;°"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m / 10)) & "&Ecirc;°"
                ElseIf Pre <> 6 Then
                   temp = temp & "&Aacute;&atilde;" & Num_To_Chinese(Int(m / 10)) & "&Ecirc;° "
                Else
                   temp = temp & Num_To_Chinese(Int(m / 10)) & "&Ecirc;°"
                End If
                Had_Frist_Num = True
                Pre = 7
                m = m - Int(m / 10) * 10
                GoTo re
          Case Is >= 1 And m < 10
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m)) & "&Ocirc;&ordf;"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m)) & "&Ocirc;&ordf;"
                ElseIf Pre <> 7 Then
                   temp = temp & "&Aacute;&atilde;" & Num_To_Chinese(Int(m)) & "&Ocirc;&ordf;"
                Else
                   temp = temp & Num_To_Chinese(Int(m)) & "&Ocirc;&ordf;"
                End If
                Had_Frist_Num = True
                Pre = 8
                m = m - Int(m)
                GoTo re
           Case Is >= 0.1
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m * 10)) & "&frac12;&Ccedil;"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m * 10)) & "&frac12;&Ccedil;"
                ElseIf Pre <> 8 Then
                   temp = temp & "&Ocirc;&ordf;&Aacute;&atilde;" & Num_To_Chinese(Int(m * 10)) & "&frac12;&Ccedil;"
                Else
                   temp = temp & Num_To_Chinese(Int(m * 10)) & "&frac12;&Ccedil;"
                End If
                Pre = 9
                m = m - Int(m * 10) / 10
                GoTo re:
          Case Is >= 0.01
                If m <> 0 Then
                 If Not Had_Frist_Num Then
                    temp = temp & Num_To_Chinese(Int(m * 100)) & "·&Ouml;"
                 ElseIf Pre <> 4 And Pre < 4 Then
                    temp = temp & "&Iacute;ò&Aacute;&atilde;" & Num_To_Chinese(Int(m * 100)) & "·&Ouml;"
                 ElseIf Pre <> 8 And Pre <> 9 Then
                    temp = temp & "&Ocirc;&ordf;&Aacute;&atilde;" & Num_To_Chinese(Int(m * 100)) & "·&Ouml;"
                 Else
                    temp = temp & Num_To_Chinese(Int(m * 100)) & "·&Ouml;"
                 End If
                End If
                Pre = 10
        End Select
        temp = Trim(temp)
        GetChineseString = temp
    End Function运行测试:Option ExplicitPrivate Sub Form_Load()
        Debug.Print GetChineseString(1225)  '返回:壹千贰百贰拾伍元
        Debug.Print GetChineseString(12.25) '返回:壹拾贰元贰角伍分
    End Sub
      

  4.   

    上面的模块代码贴得有点问题,重新贴上:----------------------------------------Option ExplicitDim Num_To_Chinese(10) As StringPrivate Sub Init_Chinese()
        Num_To_Chinese(0) = "零"
        Num_To_Chinese(1) = "壹"
        Num_To_Chinese(2) = "贰"
        Num_To_Chinese(3) = "叁"
        Num_To_Chinese(4) = "肆"
        Num_To_Chinese(5) = "伍"
        Num_To_Chinese(6) = "陆"
        Num_To_Chinese(7) = "柒"
        Num_To_Chinese(8) = "捌"
        Num_To_Chinese(9) = "玖"
    End SubPublic Function GetChineseString(ByVal m As Currency) As String
        Dim Pre As Integer
        Dim Had_Frist_Num As Boolean
        Dim temp As String
        Call Init_Chinese
        Pre = 0
    re:
        Select Case m
            Case Is >= 10000000 And m < 100000000
                Had_Frist_Num = True
                temp = Num_To_Chinese(Int(m / 10000000)) & "千"
                Pre = 1
                m = m - Int(m / 10000000) * 10000000
                GoTo re
            Case Is >= 1000000 And m < 10000000
                Had_Frist_Num = True
                temp = temp & Num_To_Chinese(Int(m / 1000000)) & "百"
                Pre = 2
                m = m - Int(m / 1000000) * 1000000
                GoTo re
            Case Is >= 100000 And m < 1000000
                If Not Had_Frist_Num Then
                   temp = Num_To_Chinese(Int(m / 100000)) & "拾"
                ElseIf Pre <> 2 Then
                    temp = temp & "零" & Num_To_Chinese(Int(m / 100000)) & "拾"
                Else
                    temp = temp & Num_To_Chinese(Int(m / 100000)) & "拾"
                End If
                Had_Frist_Num = True
                Pre = 3
                m = m - Int(m / 100000) * 100000
                GoTo re
            Case Is >= 10000 And m < 100000
                If Not Had_Frist_Num Then
                   temp = Num_To_Chinese(Int(m / 10000)) & "万"
                ElseIf Pre <> 3 Then
                   temp = temp & "零" & Num_To_Chinese(Int(m / 10000)) & "万"
                Else
                   temp = temp & Num_To_Chinese(Int(m / 10000)) & "万"
                End If
                Had_Frist_Num = True
                Pre = 4
                m = m - Int(m / 10000) * 10000
                GoTo re
          Case Is >= 1000 And m < 10000
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 1000)) & "千"
                ElseIf Pre <> 4 Then
                   temp = temp & "万零" & Num_To_Chinese(Int(m / 1000)) & "千"
                Else
                   temp = temp & Num_To_Chinese(Int(m / 1000)) & "千"
                End If
                Had_Frist_Num = True
                Pre = 5
                m = m - Int(m / 1000) * 1000
                GoTo re
           Case Is >= 100 And m < 1000
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 100)) & "百"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "万零" & Num_To_Chinese(Int(m / 100)) & "百"
                ElseIf Pre <> 5 Then
                   temp = temp & "零" & Num_To_Chinese(Int(m / 100)) & "百"
                Else
                temp = temp & Num_To_Chinese(Int(m / 100)) & "百"
                End If
                Had_Frist_Num = True
                Pre = 6
                m = m - Int(m / 100) * 100
                GoTo re
          Case Is >= 10 And m < 100
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m / 10)) & "拾"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "万零" & Num_To_Chinese(Int(m / 10)) & "拾"
                ElseIf Pre <> 6 Then
                   temp = temp & "零" & Num_To_Chinese(Int(m / 10)) & "拾 "
                Else
                   temp = temp & Num_To_Chinese(Int(m / 10)) & "拾"
                End If
                Had_Frist_Num = True
                Pre = 7
                m = m - Int(m / 10) * 10
                GoTo re
          Case Is >= 1 And m < 10
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m)) & "元"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "万零" & Num_To_Chinese(Int(m)) & "元"
                ElseIf Pre <> 7 Then
                   temp = temp & "零" & Num_To_Chinese(Int(m)) & "元"
                Else
                   temp = temp & Num_To_Chinese(Int(m)) & "元"
                End If
                Had_Frist_Num = True
                Pre = 8
                m = m - Int(m)
                GoTo re
           Case Is >= 0.1
                If Not Had_Frist_Num Then
                   temp = temp & Num_To_Chinese(Int(m * 10)) & "角"
                ElseIf Pre <> 4 And Pre < 4 Then
                   temp = temp & "万零" & Num_To_Chinese(Int(m * 10)) & "角"
                ElseIf Pre <> 8 Then
                   temp = temp & "元零" & Num_To_Chinese(Int(m * 10)) & "角"
                Else
                   temp = temp & Num_To_Chinese(Int(m * 10)) & "角"
                End If
                Pre = 9
                m = m - Int(m * 10) / 10
                GoTo re:
          Case Is >= 0.01
                If m <> 0 Then
                 If Not Had_Frist_Num Then
                    temp = temp & Num_To_Chinese(Int(m * 100)) & "分"
                 ElseIf Pre <> 4 And Pre < 4 Then
                    temp = temp & "万零" & Num_To_Chinese(Int(m * 100)) & "分"
                 ElseIf Pre <> 8 And Pre <> 9 Then
                    temp = temp & "元零" & Num_To_Chinese(Int(m * 100)) & "分"
                 Else
                    temp = temp & Num_To_Chinese(Int(m * 100)) & "分"
                 End If
                End If
                Pre = 10
        End Select
        temp = Trim(temp)
        GetChineseString = temp
    End Function
      

  5.   

    Private Sub Command1_Click()
    Label1.Caption = Rmb2(Val(Text1.Text))
    NumToRmb Text1.Text
    End SubPrivate Function Rmb2(s As Currency) As String
        Dim s2 As String
        s1 = LTrim(Str(Abs(s)))
        l = Len(s1)
        Select Case l - InStrRev(s1, ".")
            Case l
                s2 = s1 + ".00"
            Case 1
                s2 = s1 + "0"
            Case 2
                s2 = s1
        End Select
        l = Len(s2)
        dx = ""
        c1 = "零壹贰叁肆伍陆柒捌玖“"
        c2 = "分角 元拾佰仟万拾佰仟亿拾佰”"
        Do While l >= 1
            x = Mid(s2, Len(s2) - l + 1, 1)
            dx = dx + IIf(x <> ".", Mid(c1, Val(x) + 1, 1) + Trim(Mid(c2, (l - 1) + 1, 1)), "")        l = l - 1
        Loop
        Rmb2 = dx + "整"
    End FunctionPrivate Function NumToRmb(cNum As Currency) As String
        Dim Str As String
        Dim CountStr As String
        Dim sRet As String
        Dim i As Long
        Dim j As Long
        
        Str = Trim(Format(cNum, "0.00"))
        Str = Replace(Str, ".", "")
        CountStr = "零壹贰叁肆伍陆柒捌玖"
        sRet = " 佰 拾 亿 仟 佰 拾 万 仟 佰 拾 元 角 分"
        j = 25
        For i = 1 To Len(Str)
            Mid(sRet, j, 1) = Mid(CountStr, CInt(Mid(Str, Len(Str) + 1 - i, 1)) + 1, 1)
            j = j - 2
        Next
        sRet = Right(sRet, Len(sRet) - j - 1)
        NumToRmb = sRet
    End Function
    --------------------------
    RMB2是laviewpbt写的,NumToRmb是我抄他写的。
      

  6.   

    嗯,写得不错!
    不过我也提点建议。
    判断每位的数字是什么时,用fix函数是不是简单一些呢?
    比如:123456
    首先得到位数,6位。当判断首位时,用fix(123456/10^5) mod 10;
    第二位用fix(123456/10^4) mod 10;
    ……呵呵~不要笑话。