Doctrina washington
Dim Pesotes, Centavos, Temp
Dim DecimalPlace, Count
Dim origNumLen, origNum
Dim Sep, Moneda
Dim Decimales As Long
Decimales = Round(100 * (Cantidad - Int(Cantidad)), 0) 'extrae la parte decimal
ReDim place(9) As String place(2) = " MIL " place(3) = " MILLONES " place(4) = " BILLONES " place(5) = " TRILLONES "
Cantidad = Trim(CStr(Cantidad)) origNumLen = Len(Cantidad) origNum = Cantidad
'Especificar el separador de miles y/o decimales
Sep = "."
'Especificar el tipo de moneda PESOS (default)
Moneda = "PESOS"
If Sep = "." Then DecimalPlace = InStr(Cantidad, "." )
' Convert Centavos and set Cantidad to currency amount.
If DecimalPlace > 0 Then
Centavos = GetTens(Left(Mid(Cantidad, …ver más…
If Mid(Cantidad, 2, 1) "0" Then
Result = Result & GetTens(Mid(Cantidad, 2))
Else
Result = Result & GetDigit(Mid(Cantidad, 3))
End If
GetHundreds = Result
End Function
' Convertir rango de numeros del 10 hasta 99 en texto
Private Function GetTens(TensText)
Dim Result As String
Result = ""
If Val(Left(TensText, 1)) = 1 Then
Select Case Val(TensText)
Case 10: Result = "DIEZ"
Case 11: Result = "ONCE"
Case 12: Result = "DOCE"
Case 13: Result = "TRECE"
Case 14: Result = "CATORCE"
Case 15: Result = "QUINCE"
Case 16: Result = "DIECISEIS"
Case 17: Result = "DIECISIETE"
Case 18: Result = "DIECIOCHO"
Case 19: Result = "DIECINUEVE"
Case Else
End Select
Else
If Val(Right(TensText, 1)) = 0 Then
Select Case Val(Left(TensText, 1))
Case 2: Result = "VEINTE"
Case 3: Result = "TREINTA"
Case 4: Result = "CUARENTA"
Case 5: Result = "CINCUENTA"
Case 6: Result = "SESENTA"
Case 7: