数字转化罗马数字的函数

Public Function mfH00R0_Get_RomanNumerals(intNum As Long) As String
   
    Dim intArabic(12) As Integer
    Dim strRoman(12) As String
    Dim intI As Integer
    Dim strOut As String

    intArabic(0) = 1000
    intArabic(1) = 900
    intArabic(2) = 500
    intArabic(3) = 400
    intArabic(4) = 100
    intArabic(5) = 90
    intArabic(6) = 50
    intArabic(7) = 40
    intArabic(8) = 10
    intArabic(9) = 9
    intArabic(10) = 5
    intArabic(11) = 4
    intArabic(12) = 1
    strRoman(0) = "M"
    strRoman(1) = "CM"
    strRoman(2) = "D"
    strRoman(3) = "CD"
    strRoman(4) = "C"
    strRoman(5) = "XC"
    strRoman(6) = "L"
    strRoman(7) = "XL"
    strRoman(8) = "X"
    strRoman(9) = "IX"
    strRoman(10) = "V"
    strRoman(11) = "IV"
    strRoman(12) = "I"

    intI = 0

    While intNum
        While intNum >= intArabic(intI)
            intNum = intNum - intArabic(intI)
            strOut = strOut & strRoman(intI)
        Wend
        intI = intI + 1
    Wend

    mfH00R0_Get_RomanNumerals = strOut

End Function

posted @ 2006-07-26 19:20  放飞梦想  阅读(365)  评论(0编辑  收藏  举报