Conversion de numeros a letras KayKay

otsuj1
12 de Diciembre del 2003
Hola cuate KayKay espero no te molestes lo que pasa es que no se como llamar el procedimeinto que me mandaste a mi aplicacion, te molesto, me puedes decir como hago referencia a este procedimiento para que pueda usarlo en mi aplicacion te mando el codigo
Public Sub Transforma(Valor As String)

Dim frase As String
Dim letra As String
Dim palabra1 As String
Dim palabra2 As String
Dim palabra3 As String
Dim palabra4 As String
Dim palabra5 As String
Dim palabra6 As String
Dim palabra7 As String
Dim palabra8 As String
Dim palabra9 As String
Dim palabra10 As String
Dim palabra11 As String

Dim i As Integer
Dim j As Integer
Dim longitud As Integer
Dim okupas As Integer
Dim cifra() As String

Dim palabra As String
Dim mas_uno, mas_dos As Integer
Dim catalan As Boolean
Dim gfemenino As Boolean
Dim decimales As String

gfemenino = False

catalan = True 'Aqui decides el idioma

frase = ""
palabra11 = ""
palabra10 = ""
palabra9 = ""
palabra8 = ""
palabra7 = ""
palabra6 = ""
palabra5 = ""
palabra4 = ""
palabra3 = ""
palabra2 = ""
palabra1 = ""

letra = CStr(Mid(CStr(Valor), 1, Len(CStr(Valor)) - 3))
decimales = Right(CStr(Valor), 2)
letra = Replace(letra, ".", "")

longitud = Len(letra)

ReDim cifra(longitud)

For i = 1 To longitud
cifra(i) = Mid(letra, i, 1)
Next i

i = 9 - longitud + 1
okupas = longitud
j = 1
Dim z As Integer
z = 0

Do While z <= 1
Do While j <= longitud
Select Case cifra(j)
Case "0"
Case "1"
Select Case i
Case 1
'nums100
mas_uno = j + 1
mas_dos = j + 2
If cifra(mas_uno) = "0" And cifra(mas_dos) = "0" Then
palabra = IIf(catalan, " CENT", " CIEN")
If (j = 4) And (okupas = 6) Then
palabra4 = " MIL"
Else
If (j = 1) And (okupas = 9) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
End If
End If
j = j + 2
i = i + 2
Else
palabra = IIf(catalan, " CENT", " CIENTO")
End If
'fnums100
palabra11 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums10
mas_uno = j + 1
Select Case cifra(mas_uno)
Case "0"
palabra = IIf(catalan, " DEU", " DIEZ")
j = j + 1
i = i + 1
Case "1"
palabra = IIf(catalan, " ONZE", " ONCE")
j = j + 1
i = i + 1
Case "2"
palabra = IIf(catalan, " DOTZE", " DOCE")
j = j + 1
i = i + 1
Case "3"
palabra = IIf(catalan, " TRETZE", " TRECE")
j = j + 1
i = i + 1
Case "4"
palabra = IIf(catalan, " CATORZE", " CATORCE")
j = j + 1
i = i + 1
Case "5"
palabra = IIf(catalan, " QUINZE", " QUINCE")
j = j + 1
i = i + 1
Case "6"
If catalan Then
palabra = " SETZE"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case "7"
If catalan Then
palabra = " DISSET"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case Else
palabra = IIf(catalan, " DI", " DIECI")
End Select
'fnums10
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = " UN"
If palabra10 = "" And palabra11 = "" Then
palabra8 = IIf(catalan, " MILIO", " MILLON")
Else
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
End If
Case 4
'nums100
mas_uno = j + 1
mas_dos = j + 2
If cifra(mas_uno) = "0" And cifra(mas_dos) = "0" Then
palabra = IIf(catalan, " CENT", " CIEN")
If (j = 4) And (okupas = 6) Then
palabra4 = " MIL"
Else
If (j = 1) And (okupas = 9) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
End If
End If
j = j + 2
i = i + 2
Else
palabra = IIf(catalan, " CENT", " CIENTO")
End If
'fnums100
palabra7 = palabra
palabra4 = " MIL"
Case 5
'nums10
mas_uno = j + 1
Select Case cifra(mas_uno)
Case "0"
palabra = IIf(catalan, " DEU", " DIEZ")
j = j + 1
i = i + 1
Case "1"
palabra = IIf(catalan, " ONZE", " ONCE")
j = j + 1
i = i + 1
Case "2"
palabra = IIf(catalan, " DOTZE", " DOCE")
j = j + 1
i = i + 1
Case "3"
palabra = IIf(catalan, " TRETZE", " TRECE")
j = j + 1
i = i + 1
Case "4"
palabra = IIf(catalan, " CATORZE", " CATORCE")
j = j + 1
i = i + 1
Case "5"
palabra = IIf(catalan, " QUINZE", " QUINCE")
j = j + 1
i = i + 1
Case "6"
If catalan Then
palabra = " SETZE"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case "7"
If catalan Then
palabra = " DISSET"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case Else
palabra = IIf(catalan, " DI", " DIECI")
End Select
'fnums10
palabra6 = palabra
palabra4 = " MIL"
Case 6
If Val(letra) > Val("1999") Then
If gfemenino Then
palabra5 = " UNA"
Else
palabra5 = " UN"
End If
palabra4 = " MIL"
Else
palabra4 = " MIL"
End If
Case 7
'nums100
mas_uno = j + 1
mas_dos = j + 2
If cifra(mas_uno) = "0" And cifra(mas_dos) = "0" Then
palabra = IIf(catalan, " CENT", " CIEN")
If (j = 4) And (okupas = 6) Then
palabra4 = " MIL"
Else
If (j = 1) And (okupas = 9) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
End If
End If
j = j + 2
i = i + 2
Else
palabra = IIf(catalan, " CENT", " CIENTO")
End If
'fnums100
palabra3 = palabra
Case 8
'nums10
mas_uno = j + 1
Select Case cifra(mas_uno)
Case "0"
palabra = IIf(catalan, " DEU", " DIEZ")
j = j + 1
i = i + 1
Case "1"
palabra = IIf(catalan, " ONZE", " ONCE")
j = j + 1
i = i + 1
Case "2"
palabra = IIf(catalan, " DOTZE", " DOCE")
j = j + 1
i = i + 1
Case "3"
palabra = IIf(catalan, " TRETZE", " TRECE")
j = j + 1
i = i + 1
Case "4"
palabra = IIf(catalan, " CATORZE", " CATORCE")
j = j + 1
i = i + 1
Case "5"
palabra = IIf(catalan, " QUINZE", " QUINCE")
j = j + 1
i = i + 1
Case "6"
If catalan Then
palabra = " SETZE"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case "7"
If catalan Then
palabra = " DISSET"
j = j + 1
i = i + 1
Else
palabra = " DIECI"
End If
Case Else
palabra = IIf(catalan, " DI", " DIECI")
End Select
'fnums10
palabra2 = palabra
Case 9
If gfemenino Then
palabra1 = " UNA"
Else
palabra1 = " UN"
End If
End Select
Case "2"
Select Case i
Case 1
palabra11 = IIf(catalan, " DOS-CENTS", " DOSCIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums20
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VINT-I-", " VEINTI")
Else
palabra = IIf(catalan, " VINT", " VEINTE")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas = 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums20
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = " DOS"
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " DUES-CENTES", " DOSCIENTAS")
Else
palabra7 = IIf(catalan, " DOS-CENTS", " DOSCIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums20
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VINT-I-", " VEINTI")
Else
palabra = IIf(catalan, " VINT", " VEINTE")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas = 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums20
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(gfemenino, " DUES", " DOS")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " DUES-CENTES", " DOSCIENTAS")
Else
palabra3 = IIf(catalan, " DOS-CENTS", " DOSCIENTOS")
End If
Case 8
'nums20
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VINT-I-", " VEINTI")
Else
palabra = IIf(catalan, " VINT", " VEINTE")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas = 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums20
palabra2 = palabra
Case 9
If catalan And gfemenino Then
palabra1 = " DUES"
Else
palabra1 = " DOS"
End If
End Select
Case "3"
Select Case i
Case 1
palabra11 = IIf(catalan, " TRES-CENTS", " TRESCIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums30
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " TRENTA-", " TREINTA Y")
Else
palabra = IIf(catalan, " TRENTA", " TREINTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums30
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = " TRES"
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
palabra7 = IIf(catalan, " TRES-CENTES", " TRESCIENTAS")
palabra4 = " MIL"
Case 5
'nums30
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " TRENTA-", " TREINTA Y")
Else
palabra = IIf(catalan, " TRENTA", " TREINTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums30
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = " TRES"
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " TRES-CENTES", " TRESCIENTAS")
Else
palabra3 = IIf(catalan, " TRES-CENTS", " TRESCIENTOS")
End If
Case 8
'nums30
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " TRENTA-", " TREINTA Y")
Else
palabra = IIf(catalan, " TRENTA", " TREINTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums30
palabra2 = palabra
Case 9
palabra1 = " TRES"
End Select
Case "4"
Select Case i
Case 1
palabra11 = IIf(catalan, " QUATRE-CENTS", " CUATROCIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums40
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " QUARANTA-", " CUARENTA Y")
Else
palabra = IIf(catalan, " QUARANTA", " CUARENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums40
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " QUATRE", " CUATRO")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
palabra7 = IIf(catalan, " QUATRE-CENTES", " CUATROCIENTAS")
palabra4 = " MIL"
Case 5
'nums40
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " QUARANTA-", " CUARENTA Y")
Else
palabra = IIf(catalan, " QUARANTA", " CUARENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums40
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " QUATRE", " CUATRO")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " QUATRE-CENTES", " CUATROCIENTAS")
Else
palabra3 = IIf(catalan, " QUATRE-CENTS", " CUATROCIENTOS")
End If
Case 8
'nums40
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " QUARANTA-", " CUARENTA Y")
Else
palabra = IIf(catalan, " QUARANTA", " CUARENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums40
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " QUATRE", " CUATRO")
End Select
Case "5"
Select Case i
Case 1
palabra11 = IIf(catalan, " CINC-CENTS", " QUINIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums50
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " CINQUANTA-", " CINCUENTA Y")
Else
palabra = IIf(catalan, " CINQUANTA", " CINCUENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums50
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " CINC", " CINCO")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " CINC-CENTES", " QUINIENTAS")
Else
palabra7 = IIf(catalan, " CINC-CENTS", " QUINIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums50
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " CINQUANTA-", " CINCUENTA Y")
Else
palabra = IIf(catalan, " CINQUANTA", " CINCUENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums50
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " CINC", " CINCO")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " CINC-CENTES", " QUINIENTAS")
Else
palabra3 = IIf(catalan, " CINC-CENTS", " QUINIENTOS")
End If
Case 8
'nums50
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " CINQUANTA-", " CINCUENTA Y")
Else
palabra = IIf(catalan, " CINQUANTA", " CINCUENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums50
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " CINC", " CINCO")
End Select
Case "6"
Select Case i
Case 1
palabra11 = IIf(catalan, " SIS-CENTS", " SEISCIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums60
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SEIXANTA-", " SESENTA Y")
Else
palabra = IIf(catalan, " SEIXANTA", " SESENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums60
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " SIS", " SEIS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " SIS-CENTES", " SEISCIENTAS")
Else
palabra7 = IIf(catalan, " SIS-CENTS", " SEISCIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums60
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SEIXANTA-", " SESENTA Y")
Else
palabra = IIf(catalan, " SEIXANTA", " SESENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums60
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " SIS", " SEIS")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " SIS-CENTES", " SEISCIENTAS")
Else
palabra3 = IIf(catalan, " SIS-CENTS", " SEISCIENTOS")
End If
Case 8
'nums60
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SEIXANTA-", " SESENTA Y")
Else
palabra = IIf(catalan, " SEIXANTA", " SESENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums60
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " SIS", " SEIS")
End Select
Case "7"
Select Case i
Case 1
palabra11 = IIf(catalan, " SET-CENTS", " SETECIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums70
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SETANTA-", " SETENTA Y")
Else
palabra = IIf(catalan, " SETANTA", " SETENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums70
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " SET", " SIETE")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " SET-CENTES", " SETECIENTAS")
Else
palabra7 = IIf(catalan, " SET-CENTS", " SETECIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums70
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SETANTA-", " SETENTA Y")
Else
palabra = IIf(catalan, " SETANTA", " SETENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums70
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " SET", " SIETE")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " SET-CENTES", " SETECIENTAS")
Else
palabra3 = IIf(catalan, " SET-CENTS", " SETECIENTOS")
End If
Case 8
'nums70
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " SETANTA-", " SETENTA Y")
Else
palabra = IIf(catalan, " SETANTA", " SETENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums70
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " SET", " SIETE")
End Select
Case "8"
Select Case i
Case 1
palabra11 = IIf(catalan, " VUIT-CENTS", " OCHOCIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums80
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VUITANTA-", " OCHENTA Y")
Else
palabra = IIf(catalan, " VUITANTA", " OCHENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums80
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " VUIT", " OCHO")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " VUIT-CENTES", " OCHOCIENTAS")
Else
palabra7 = IIf(catalan, " VUIT-CENTS", " OCHOCIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums80
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VUITANTA-", " OCHENTA Y")
Else
palabra = IIf(catalan, " VUITANTA", " OCHENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums80
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " VUIT", " OCHO")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " VUIT-CENTES", " OCHOCIENTAS")
Else
palabra3 = IIf(catalan, " VUIT-CENTS", " OCHOCIENTOS")
End If
Case 8
'nums80
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " VUITANTA-", " OCHENTA Y")
Else
palabra = IIf(catalan, " VUITANTA", " OCHENTA")
If (j = 2 Or j = 1) And (okupas >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums80
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " VUIT", " OCHO")
End Select
Case "9"
Select Case i
Case 1
palabra11 = IIf(catalan, " NOU-CENTS", " NOVECIENTOS")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 2
'nums90
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " NORANTA-", " NOVENTA Y ")
Else
palabra = IIf(catalan, " NORANTA", " NOVENTA")
If (j = 2) And (j >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums90
palabra10 = palabra
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 3
palabra9 = IIf(catalan, " NOU", " NUEVE")
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Case 4
If gfemenino Then
palabra7 = IIf(catalan, " NOU-CENTES", " NOVECIENTAS")
Else
palabra7 = IIf(catalan, " NOU-CENTS", " NOVECIENTOS")
End If
palabra4 = " MIL"
Case 5
'nums90
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " NORANTA-", " NOVENTA Y ")
Else
palabra = IIf(catalan, " NORANTA", " NOVENTA")
If (j = 2) And (j >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums90
palabra6 = palabra
palabra4 = " MIL"
Case 6
palabra5 = IIf(catalan, " NOU", " NUEVE")
palabra4 = " MIL"
Case 7
If gfemenino Then
palabra3 = IIf(catalan, " NOU-CENTES", " NOVECIENTAS")
Else
palabra3 = IIf(catalan, " NOU-CENTS", " NOVECIENTOS")
End If
Case 8
'nums90
mas_uno = j + 1
If cifra(mas_uno) <> "0" Then
palabra = IIf(catalan, " NORANTA-", " NOVENTA Y ")
Else
palabra = IIf(catalan, " NORANTA", " NOVENTA")
If (j = 2) And (j >= 8) Then
palabra8 = IIf(catalan, " MILIONS", " MILLONES")
Else
If (j = 1 Or j = 3) And (okupas >= 5) Then
palabra4 = " MIL"
End If
End If
End If
'fnums90
palabra2 = palabra
Case 9
palabra1 = IIf(catalan, " NOU", " NUEVE")
End Select
End Select
i = i + 1
j = j + 1
Loop
If ((palabra10 = " DIECI") Or (palabra10 = " VEINTI")) Or catalan Then
palabra9 = Trim(palabra9)
End If
If ((palabra6 = " DIECI") Or (palabra6 = " VEINTI")) Or catalan Then
palabra5 = Trim(palabra5)
End If
If catalan And Right(palabra2, 1) = "-" Then
palabra1 = Trim(palabra1)
End If

If frase <> "" And decimales <> "00" Then
'IIF(catalan,frase=frase & " AMB ", frase = frase & " CON ")
If catalan Then
frase = frase & " AMB "
Else
frase = frase & " CON "
End If
End If
frase = frase + Trim(palabra11 + palabra10 + palabra9 + palabra8 + palabra7 + _
palabra6 + palabra5 + palabra4 + palabra3 + palabra2 + palabra1)

'decimales = Right(CStr(Me.tbnum.Text), 2)
If z = 0 Then
palabra11 = ""
palabra10 = ""
palabra9 = ""
palabra8 = ""
palabra7 = ""
palabra6 = ""
palabra5 = ""
palabra4 = ""
palabra3 = ""
palabra2 = ""
palabra1 = ""

longitud = Len(decimales)

ReDim cifra(longitud)

For i = 1 To longitud
cifra(i) = Mid(decimales, i, 1)
Next i
i = 9 - longitud + 1
okupas = longitud
j = 1
End If
z = z + 1
Loop

Dim formula As String

formula = "***" & frase & "***"

MsgBox formula

End Sub

gracias por tu ayuda cuate te lo agradesco mucho y cuidate bye.






kinoscar
12 de Diciembre del 2003
para llamar un procedimiento se hace asi
valor="12364"
transformar(valor) 'si el procedimiento esta en el mismo formulario

call transformar(valor) ' si el procedimiento esta en otro formulario o en algun modulo

Guillermo
12 de Diciembre del 2003
si lo que deseas es transformar de monto ($) a palabras, escribeme un correo y te enviare un proyecto donde se realiza este calculo..., y si es posible mandame tu fotito..

Guillermo.

KayKay
12 de Diciembre del 2003
Hola Para llamarlo, como bien ha dicho nuestro compañero antes tienes que hacer un call, pero , te comento, esta funcion esta pensada para trabajar con Euros, por lo que trabaja con dos decimales, es decir si lo que quieres es poner un "5" tendrias que poner "5,00", te comento también que el codigo de la funcion es muy largo porque trabaja con dos idiomas, por lo que hace en castellano es facil escribir numeros en letras, pero en catalan es bastante complejo y hay muchas normas.
Para llamarla hazlo con uno de los dos modos siguientes :

1-

Valor = "1024,00"
Call Transformar(Valor)

2 -

Call Transformar("1024,00")