اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الأرقام إلى حروف بالدينار الجزائري


higo2015

الردود الموصى بها

أهلا أخي العزيز 🙂 

هناك عشرات المواضيع التي تتكلم عن نفس الموضع 🙂 ،

أنظر هنا :

https://www.officena.net/ib/search/?q=تفقيط&quick=1&type=forums_topic&nodes=89

  • Like 2
رابط هذا التعليق
شارك

وجدت لك هذه الدالة أخي هيجو 🙂 

Public Function Chiffrelettre(s)
Dim a As Variant, gros As Variant
a = Array("", "un", "deux", "trois", "quatre", "cinq", "six", "sept", _
"huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix sept", _
"dix huit", "dix neuf", "vingt", "vingt et un", "vingt deux", "vingt trois", "vingt quatre", _
"vingt cinq", "vingt six", "vingt sept", "vingt huit", "vingt neuf", "trente", "trente et un", _
"trente deux", "trente trois", "trente quatre", "trente cinq", "trente six", "trente sept", _
"trente huit", "trente neuf", "quarante", "quarante et un", "quarante deux", "quarante trois", _
"quarante quatre", "quarante cinq", "quarante six", "quarante sept", "quarante huit", _
"quarante neuf", "cinquante", "cinquante et un", "cinquante deux", "cinquante trois", _
"cinquante quatre", "cinquante cinq", "cinquante six", "cinquante sept", "cinquante huit", _
"cinquante neuf", "soixante", "soixante et un", "soixante deux", "soixante trois", _
"soixante quatre", "soixante cinq", "soixante six", "soixante sept", "soixante huit", _
"soixante neuf", "soixante dix", "soixante et onze", "soixante douze", "soixante treize", _
"soixante quatorze", "soixante quinze", "soixante seize", "soixante dix sept", _
"soixante dix huit", "soixante dix neuf", "quatre-vingts", "quatre-vingt un", _
"quatre-vingt deux", "quatre-vingt trois", "quatre-vingt quatre", "quatre-vingt cinq", _
"quatre-vingt six", "quatre-vingt sept", "quatre-vingt huit", "quatre-vingt neuf", _
"quatre-vingt dix", "quatre-vingt onze", "quatre-vingt douze", "quatre-vingt treize", _
"quatre-vingt quatorze", "quatre-vingt quinze", "quatre-vingt seize", "quatre-vingt dix sept", _
"quatre-vingt dix huit", "quatre-vingt dix neuf")
gros = Array("", "billions", "milliards", "millions", "mille", "Dirhams", "billion", _
"milliard", "million", "mille", "Dirhams")
sp = Space(1)
chaine = "00000000000000"
centime = s * 100 - (Int(s) * 100)
s = Str(Int(s)): lg = Len(s) - 1: s = Right(s, lg): lg = Len(s)
If lg < 15 Then chaine = Mid(chaine, 1, (15 - lg)) Else chaine = ""
s = chaine + s
'billions au centaines
gp = 1
For k = 1 To 5
x = Mid(s, gp, 1): C = a(Val(x))
x = Mid(s, gp + 1, 2): D = a(Val(x))
If k = 5 Then
If t2 <> "" And C & D = "" Then mydz = "Euros" & sp: GoTo fin
If t <> "" And C = "" And D = "un" Then mydz = "un Euros" & sp: GoTo fin
If t <> "" And t2 = "" And C & D = "" Then mydz = "d'Euros" & sp: GoTo fin
If t & C & D = "" Then myct = "": mydz = "": GoTo fin
End If
If C & D = "" Then GoTo fin
If D = "" And C <> "" And C <> "un" Then mydz = C & sp & "cents " & gros(k) & sp: GoTo fin
If D = "" And C = "un" Then mydz = "cent " & gros(k) & sp: GoTo fin
If D = "un" And C = "" Then myct = IIf(k = 4, gros(k) & sp, "un " & gros(k + 5) & sp): GoTo fin
If D <> "" And C = "un" Then mydz = "cent" & sp
If D <> "" And C <> "" And C <> "un" Then mydz = C & sp & "cent" + sp
myct = D & sp & gros(k) & sp
fin:
t2 = mydz & myct
t = t & mydz & myct
mydz = "": myct = ""
gp = gp + 3
Next
D = a(centime)
If t <> "" Then myct = IIf(centime = 1, " centime", " centimes")
If t = "" Then myct = IIf(centime = 1, " centime d'Euro", " centimes d'Euro")
If centime = 0 Then D = "": myct = ""
Chiffrelettre = t & D & myct
End Function

ولكن تأكد من تعطيل خيار Option Explicit لأن في الكود الكثير من المتغيرات الغير معرفة .. 😅🖐🏼️

تم تعديل بواسطه Moosak
رابط هذا التعليق
شارك

وهذه أخرى :

🙂

Function ConversionHeures(Nombre As Integer) As String

    If Nombre = 0 Or Nombre = 24 Then
        ConversionHeures = "Minuit "
         Exit Function
        ElseIf Nombre = 12 Then
        ConversionHeures = "Midi "
        Exit Function
    End If

        
    Const stEspace As String = " "
    Dim Varnum, VarnumD, VarnumU, Resultat, Varlet

    Static Chiffre(1 To 19)
    Chiffre(1) = "une"
    Chiffre(2) = "deux"
    Chiffre(3) = "trois"
    Chiffre(4) = "quatre"
    Chiffre(5) = "cinq"
    Chiffre(6) = "six"
    Chiffre(7) = "sept"
    Chiffre(8) = "huit"
    Chiffre(9) = "neuf"
    Chiffre(10) = "dix"
    Chiffre(11) = "onze"
    Chiffre(12) = "douze"
    Chiffre(13) = "treize"
    Chiffre(14) = "quatorze"
    Chiffre(15) = "quinze"
    Chiffre(16) = "seize"
    Chiffre(17) = "dix-sept"
    Chiffre(18) = "dix-huit"
    Chiffre(19) = "dix-neuf"

    Static dizaine(1 To 9, 1 To 5)
    dizaine(1, 1) = "dix"
    dizaine(2, 1) = "vingt"
    dizaine(3, 1) = "trente"
    dizaine(4, 1) = "quarante"
    dizaine(5, 1) = "cinquante"
    dizaine(6, 1) = "soixante"
    dizaine(7, 1) = "soixante"
    dizaine(8, 1) = "quatre-vingt"
    dizaine(9, 1) = "quatre-vingt"

    Resultat = ""
    Varnum = Int(Nombre) Mod 1000
    If Varnum > 0 Then
        GoSub centaine_dizaine
        Resultat = Resultat + " " + Varlet
    End If
    Resultat = LTrim(Resultat)
    Varlet = Right$(Resultat, 4)
    'traitement du "s" final pour vingt et cent
    Select Case Varlet
        Case "cent", "ingt"
            Resultat = Resultat + "s"
    End Select


FinTraitement:
    Resultat = Resultat + stEspace
    'renvoi du résultat de la fonction et fin de la fonction
    ConversionHeures = Replace(Resultat, "  ", " ")
    Exit Function

    'sous programme
centaine_dizaine:
    Varlet = ""

    'traitement des centaines
    If Varnum >= 100 Then
        Varlet = Chiffre(Int(Varnum / 100))
        Varnum = Varnum Mod 100
        If Varlet = "un" Then
            Varlet = "cent "
        Else
            Varlet = Varlet + " cent "
        End If
    End If

    'traitement des dizaines
        If Varnum <= 19 Then
            If Varnum > 0 Then: Varlet = Varlet + Chiffre(Varnum)
        Else
            VarnumD = Int(Varnum / 10)
            VarnumU = Varnum Mod 10
            Varlet = Varlet + dizaine(VarnumD, 1)
            If VarnumU = 1 And VarnumD < 8 Then
                Varlet = Varlet + " et "
            Else
                If VarnumU <> 0 Or VarnumD = 7 Or VarnumD = 9 Then: Varlet = Varlet & " "
            End If
            If VarnumD = 7 Or VarnumD = 9 Then: VarnumU = VarnumU + 10
            If VarnumU <> 0 Then: Varlet = Varlet + Chiffre(VarnumU)
        End If
        Varlet = Trim(Varlet)
        Return
End Function

 

رابط هذا التعليق
شارك

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information