Public Function NumToChi(Figure) As String
Dim lFigure1 As Long
Dim lFigure2 As Long
Dim lFigure3 As Long
'Not a figure
If Not IsNumeric(Figure) Then
NumToChi = "#NotANumber"
Exit Function
End If
Call InitChiFig
'Round the figure
Figure = Round(Figure, 2)
'0 to 10,000
If Figure >= 0 And Figure < 10000 Then
lFigure1 = Int(Figure)
lFigure2 = (Figure - lFigure1) * 100
If lFigure2 = 0 Then
NumToChi = NumToChi_01(lFigure1)
Else
NumToChi = NumToChi_01(lFigure1) _
& "点" & NumToChi_02(lFigure2)
End If
End If
'10,000 to 100,000,000
If Figure >= 10000 And Figure < 100000000 Then
lFigure1 = Figure \ 10000
lFigure2 = Int(Figure - lFigure1 * 10000)
lFigure3 = (Figure - lFigure1 * 10000 - lFigure2) * 100
'100
If lFigure2 = 0 And lFigure3 = 0 Then
NumToChi = NumToChi_01(lFigure1) & "万"
End If
'101
If lFigure2 = 0 And lFigure3 <> 0 Then
NumToChi = NumToChi_01(lFigure1) & "万点" _
& NumToChi_02(lFigure3)
End If
'110
If lFigure2 <> 0 And lFigure3 = 0 Then
If lFigure2 < 1000 Then
NumToChi = NumToChi_01(lFigure1) & "万零" _
& NumToChi_01(lFigure2)
Else
NumToChi = NumToChi_01(lFigure1) & "万" _
& NumToChi_01(lFigure2)
End If
End If
'111
If lFigure2 <> 0 And lFigure3 <> 0 Then
If lFigure2 < 1000 Then
NumToChi = NumToChi_01(lFigure1) & "万零" _
& NumToChi_01(lFigure2) & "点" _
& NumToChi_02(lFigure3)
Else
NumToChi = NumToChi_01(lFigure1) & "万" _
& NumToChi_01(lFigure2) & "点" _
& NumToChi_02(lFigure3)
End If
End If
End If
If Figure >= 100000000 Then '100,000,000
NumToChi = "#NotDefined"
End If
End Function