在他基础上改的有点不好
有空重新做个简洁点的给你看
Private Sub Command1_Click()
Dim num As Long, num_t As Long, i As Long, l As Long, s As Long
Dim rmb As String, rmb_char As String, rmb_weight As String
l = Len(Text1.Text)
s = InStr(1, Text1.Text, ".", vbTextCompare)
If s = 0 Then
For i = l To 1 Step -1
num_t = num
num = Mid(Text1.Text, l - i + 1, 1)
If num_t = num And num = 0 Then GoTo ooo1
rmb_char = IIf(num = 0, "零", Choose(num, "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"))
rmb_weight = Choose(i, "", "拾", "佰", "仟", "萬", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾萬", "拾"), "佰", "仟", "萬", "亿", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾亿", "拾"), "佰", "仟", "萬")
rmb = rmb & rmb_char & IIf(num = 0, "", rmb_weight)
ooo1:
Next i
rmb = IIf(Mid(rmb, Len(rmb), Len(rmb)) = "零", Mid(rmb, 1, Len(rmb) - 1), rmb)
MsgBox rmb
Exit Sub
Else
For i = s - 1 To 1 Step -1
num_t = num
num = Mid(Text1.Text, s - i, 1)
If num_t = num And num = 0 Then GoTo ooo2
rmb_char = IIf(num = 0, "零", Choose(num, "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"))
rmb_weight = Choose(i, "", "拾", "佰", "仟", "萬", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾萬", "拾"), "佰", "仟", "萬", "亿", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾亿", "拾"), "佰", "仟", "萬")
rmb = rmb & rmb_char & IIf(num = 0, "", rmb_weight)
ooo2:
Next i
rmb = IIf(Mid(rmb, Len(rmb), Len(rmb)) = "零", Mid(rmb, 1, Len(rmb) - 1), rmb)
If s <> l Then rmb = rmb & "点"
For i = l To s + 1 Step -1
num = Mid(Text1.Text, s - i + 1 + l, 1)
rmb_char = IIf(num = 0, "零", Choose(num, "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"))
rmb = rmb & rmb_char
Next i
MsgBox rmb
Exit Sub
End If
End Sub
[此贴子已经被作者于2007-11-15 18:56:39编辑过]