Visual Basic - cambiar numeros a palabras

Life is soft - evento anual de software empresarial
 
Vista:

cambiar numeros a palabras

Publicado por RICARDO VERA (10 intervenciones) el 16/10/2004 03:12:42
yo de nuevo, agradezco a quienes me aYUDARON anterormente, tengo una consulta si existe una rutina rapida que pueda cambiar cifras de numeros a palabras, por ejemplo 1200 a mil doscientos, esto es para un sistema de emision de facturas
gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:cambiar numeros a palabras

Publicado por bm (29 intervenciones) el 16/10/2004 04:13:45
A ver si te sirve esta que encontre por ahi.

hecha por PANDIANI JAVIER.

Function Nombre(x)
'aRMA CADA GRUPO DE TRES DIGITOS
xuni = "UNO DOS TRES CUATRO CINCO " + _
"SEIS SIETE OCHO NUEVE DIEZ " + _
"ONCE DOCE TRECE CATORCE QUINCE " + _
"DIECISEIS DIECISIETE DIECIOCHO DIECINUEVE VEINTE " + _
"VEINTIUNO VEINTIDOS VEINTITRES VEINTICUATROVEINTICINCO " + _
"VEINTISEIS VEINTISIETE VEINTIOCHO VEINTINUEVE "
xdec = "TREINTA CUARENTA CINCUENTASESENTA SETENTA OCHENTA NOVENTA"
xcent = "DOSC TRESC CUATROCQUIN SEISC SETEC OCHOC NOVEC "
Nombre = ""
'Ver para anular los decimales para que no se produzcan erroresx = Fix(x)
UNI = Right(x, 2)
If UNI < 30 And UNI > 0 Then
Nombre = Trim(Mid(xuni, 12 * (UNI - 1) + 1, 12))
End If
If UNI > 29 Then
dec = Left(UNI, 1)
UNI = Right(UNI, 1)
Nombre = Trim(Mid(xdec, 9 * (dec - 3) + 1, 9))
If UNI <> 0 Then
Nombre = Nombre + " Y " + Trim(Mid(xuni, 12 * (UNI - 1) + 1, 12))
End If
End If
Cent = Int(x / 100)
If Cent = 1 Then
Nombre = "CIENTO " + Nombre
End If
If x = 100 Then
Nombre = "CIEN"
End If
If Cent > 1 Then
Nombre = Trim(Mid(xcent, 7 * (Cent - 2) + 1, 7)) + "IENTOS " + Nombre
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar