<%
Function rmb(num)
num &#61; FormatNumber(num, 2)
Dim numList
Dim rmbList
Dim numLen
Dim numChar
Dim numstr
Dim n
Dim n1, n2
Dim hz
numList &#61; "零壹贰叁肆伍陆柒捌玖"
rmbList &#61; "分角元拾佰仟万拾佰仟亿拾佰仟万"
If num > 9999999999999.99 Then
rmb &#61; "超出范围的人民币值"
Exit Function
End If
numstr &#61; CStr(num * 100)
numLen &#61; Len(numstr)
n &#61; 1
Do While n <&#61; numLen
numChar &#61; CInt(Mid(numstr, n, 1))
n1 &#61; Mid(numList, numChar &#43; 1, 1)
n2 &#61; Mid(rmbList, numLen - n &#43; 1, 1)
If Not n1 &#61; "零" Then
hz &#61; hz &#43; CStr(n1) &#43; CStr(n2)
Else
If n2 &#61; "亿" Or n2 &#61; "万" Or n2 &#61; "元" Or n1 &#61; "零" Then
Do While Right(hz, 1) &#61; "零"
hz &#61; Left(hz, Len(hz) - 1)
Loop
End If
If (n2 &#61; "亿" Or (n2 &#61; "万" And Right(hz, 1) <> "亿") Or n2 &#61; "元") Then
hz &#61; hz &#43; CStr(n2)
Else
If Left(Right(hz, 2), 1) &#61; "零" Or Right(hz, 1) <> "亿" Then
hz &#61; hz &#43; n1
End If
End If
End If
n &#61; n &#43; 1
Loop
Do While Right(hz, 1) &#61; "零"
hz &#61; Left(hz, Len(hz) - 1)
Loop
If Right(hz, 1) &#61; "元" Then
hz &#61; hz &#43; "整"
End If
rmb &#61; hz
End Function
%>