Public Function URmb(ByVal Money As Double) As String '取得数字的汉字大写
Dim Intlen As Integer
Dim i As Integer
Dim strMoney As String
Dim bnlFu As Boolean
If Money < 0 Then '如果金额小于零,则标志变量为"真"
bnlFu = True
End If
Money = Abs(Money) '取绝对值
If Money < 0.005 Then '如果小于5厘,则以零计
URmb = "RMB零分"
Exit Function
End If
If Money >= 0.005 And Money < 0.01 Then '5厘和壹分之间以壹分计
If bnlFu = False Then
URmb = "RMB壹分"
Else
URmb = "RMB负壹分"
End If
Exit Function
End If
strMoney = Format(Money, "#.##") * 100
Intlen = Len(strMoney)
If Intlen > 14 Then
URmb = Format(Money, "#.##")
Exit Function
End If
For i = 1 To Intlen
URmb = Mid("零壹贰叁肆伍陆柒捌玖", Mid(strMoney, Intlen + 1 - i, 1) + 1, 1) _
& Mid("分角元拾佰仟万拾佰仟亿拾佰仟", i, 1) & URmb
Next
If bnlFu = True Then '加上负数标记
URmb = "RMB负" & URmb
Else
URmb = "RMB" & URmb
End If
End Function