帮我看个函数错误，谢谢

put2001_ruan 2003-11-24 01:02:32
''功能：把数字总金额转换为大写金额
'Private Function AccountChang(ByRef strWan As String, ByRef strQian As String, ByRef strBai As String, ByRef strShi As String, _
' ByRef strKuai As String, ByRef strJiao As String, ByRef strFen As String, ByVal strAccount As String)
' Dim StrFPSum As String
' Dim intTemp(10)
' Dim strLeft As String
' Dim strRight As String
' Dim strBLeft As String
' Dim strBRight As String
'
' '初始化
' StrFPSum = ""
' strAccount = Format(strAccount, "#########0.00")
' intTemp(0) = "零": intTemp(1) = "壹": intTemp(2) = "贰": intTemp(3) = "叁": intTemp(4) = "肆"
' intTemp(5) = "伍": intTemp(6) = "陆": intTemp(7) = "柒": intTemp(8) = "捌": intTemp(9) = "疚"
'
' '取得小数点前后的字符串形式的数字
' strLeft = Left(strAccount, InStr(strAccount, ".") - 1)
' strRight = Mid(strAccount, Len(strAccount) - 1)
'
' For i = 0 To Len(strRight) - 1
' StrFPSum = intTemp(CInt(Mid(strRight, Len(strRight) - i, 1))) & StrFPSum
' Next
' StrFPSum = "." & StrFPSum
' For i = 0 To Len(strLeft) - 1
' StrFPSum = intTemp(CInt(Mid(strLeft, Len(strLeft) - i, 1))) & StrFPSum
' Next
'
' strBLeft = Left(StrFPSum, InStr(StrFPSum, ".") - 1)
' strBRight = Mid(StrFPSum, Len(StrFPSum) - 1)
'
'On Error Resume Next
' strFen = Mid(strBRight, 2, 1)
' strJiao = Mid(strBRight, 1, 1)
' strKuai = Mid(strBLeft, Len(strBLeft), 1)
' strShi = Mid(strBLeft, Len(strBLeft) - 1, 1)
' strBai = Mid(strBLeft, Len(strBLeft) - 2, 1)
' strQian = Mid(strBLeft, Len(strBLeft) - 3, 1)
' strWan = Mid(strBLeft, Len(strBLeft) - 4, 1)
'End Function

AccountChang Text1.Text, Text2.Text, Text3.Text, Text4.Text, Text5.Text, Text6.Text,Text7, Text8.Text

...全文
23 4 打赏 收藏 转发到动态 举报

4 条回复

put2001_ruan 2003-11-24
• 打赏
• 举报

cwl500449 2003-11-24
• 打赏
• 举报

'功能：把数字总金额转换为大写金额
Private Function AccountChang(ByVal strWan As String, ByVal strQian As String, ByVal strBai As String, _
ByVal strShi As String, _
ByVal strKuai As String, ByVal strJiao As String, ByVal strFen As String, ByVal strAccount As String)

Dim StrFPSum As String
Dim intTemp(10)
Dim strLeft As String
Dim strRight As String
Dim strBLeft As String
Dim strBRight As String

'初始化
StrFPSum = ""
strAccount = Format(strAccount, "#########0.00")
intTemp(0) = "零": intTemp(1) = "壹": intTemp(2) = "贰": intTemp(3) = "叁": intTemp(4) = "肆"
intTemp(5) = "伍": intTemp(6) = "陆": intTemp(7) = "柒": intTemp(8) = "捌": intTemp(9) = "疚"

'取得小数点前后的字符串形式的数字
strLeft = Left(strAccount, InStr(strAccount, ".") - 1)
strRight = Mid(strAccount, Len(strAccount) - 1)

For i = 0 To Len(strRight) - 1
StrFPSum = intTemp(CInt(Mid(strRight, Len(strRight) - i, 1))) & StrFPSum
Next
StrFPSum = "." & StrFPSum
For i = 0 To Len(strLeft) - 1
StrFPSum = intTemp(CInt(Mid(strLeft, Len(strLeft) - i, 1))) & StrFPSum
Next

strBLeft = Left(StrFPSum, InStr(StrFPSum, ".") - 1)
strBRight = Mid(StrFPSum, Len(StrFPSum) - 1)

On Error Resume Next
strFen = Mid(strBRight, 2, 1)
strJiao = Mid(strBRight, 1, 1)
strKuai = Mid(strBLeft, Len(strBLeft), 1)
strShi = Mid(strBLeft, Len(strBLeft) - 1, 1)
If Len(strBLeft) - 2 = 0 Then
strBai = "零"
Else
strBai = Mid(strBLeft, Len(strBLeft) - 2, 1)
End If
If Len(strBLeft) - 2 = 0 Or Len(strBLeft) - 3 = 0 Then
strQian = "零"
Else
strQian = Mid(strBLeft, Len(strBLeft) - 3, 1)
End If
If Len(strBLeft) - 2 = 0 Or Len(strBLeft) - 3 = 0 Or Len(strBLeft) - 4 = 0 Then
strWan = "零"
Else
strWan = Mid(strBLeft, Len(strBLeft) - 4, 1)
End If

Text1.Text = strWan
Text2.Text = strQian
Text3.Text = strBai
Text4.Text = strShi
Text5.Text = strKuai
Text6.Text = strJiao
Text7.Text = strFen
End Function
put2001_ruan 2003-11-24
• 打赏
• 举报

AccountChang strWans, strQians, strBais, strShis, strKuais, strJiaos, strFens, Text8.Text
shwen 2003-11-24
• 打赏
• 举报

AccountChang str1, str2, str2 ...
Text1.Text = str1
Text2.Text = str2
...

7,732

• 近7日
• 近30日
• 至今