'将小写数字转换成大写数字:
Public Function ToChinNum(pStrEng As String) As String
On Error GoTo Err
If Not IsNumeric(pStrEng) Then
ToChinNum = ""
Exit Function
End If
Dim strEng2Ch As String, strSeqCh1 As String, strSeqCh2 As String
Dim strCh As String, strTempCh As String, strTempXs As String
Dim intLen As Integer, i As Integer
strEng2Ch = "零壹贰叁肆伍陆柒捌玖"
strSeqCh1 = " 拾佰仟 拾佰仟 拾佰仟 拾佰仟"
strSeqCh2 = " 万亿兆"
pStrEng = CStr(CDec(pStrEng))
If Left(pStrEng, 1) = "-" Then '是负数
strCh = "负"
pStrEng = Right(pStrEng, Len(pStrEng) - 1)
End If
intLen = InStr(pStrEng, ".")
If intLen > 0 Then '有小数
strTempXs = Right(pStrEng, Len(pStrEng) - intLen)
pStrEng = Left(pStrEng, intLen - 1)
End If
intLen = Len(pStrEng)
For i = 1 To intLen
strTempCh = Mid(strEng2Ch, Val(Mid(pStrEng, i, 1)) + 1, 1)
If strTempCh = "零" And intLen <> 1 Then
If Mid(pStrEng, i + 1, 1) = "0" Or (intLen - i + 1) Mod 4 = 1 Then
strTempCh = ""
End If
Else
strTempCh = strTempCh & Trim(Mid(strSeqCh1, intLen - i + 1, 1))
End If
If (intLen - i + 1) Mod 4 = 1 Then
strTempCh = strTempCh & Mid(strSeqCh2, (intLen - i + 1) \ 4 + 1, 1)
If i > 3 Then
If Mid(pStrEng, i - 3, 4) = "0000" Then strTempCh = Left(strTempCh, Len(strTempCh) - 1)
End If
End If
strCh = strCh & Trim(strTempCh)
Next
intLen = Len(strTempXs)
If intLen > 0 Then
If strCh = "" Or strCh = "负" Then
strCh = strCh & "零"
End If
strCh = strCh & "点"
For i = 1 To intLen
strCh = strCh & Mid(strEng2Ch, Val(Mid(strTempXs, i, 1)) + 1, 1)
Next
End If
ToChinNum = strCh
Exit Function
Err:
ToChinNum = ""
End Function