Attribute VB_Name = "mdlAngka2Text" Dim satuan(9) As String Function Angka2Text(Angka) As String Dim juta As String Dim ribu As String Dim ratus As String Dim tAngka2Text As String 'Mapping satuan(1) = "satu" satuan(2) = "dua" satuan(3) = "tiga" satuan(4) = "empat" satuan(5) = "lima" satuan(6) = "enam" satuan(7) = "tujuh" satuan(8) = "delapan" satuan(9) = "sembilan" aaa = Right(" " + Left(Format(Angka, "########"), 9), 9) 'Debug.Print aaa 'Debug.Print Left(aaa, 3) 'Debug.Print Mid(aaa, 4, 3) If Angka >= 1000000 Then juta = TerBilang(Left(aaa, 3)) + " juta " End If If Angka >= 1000 Then If Right(Angka, 7) = "1000000" Then 'nothing Else If Mid(aaa, 4, 3) = "000" Then 'nothing Else ribu = TerBilang(Mid(aaa, 4, 3)) + " ribu " End If End If End If If Angka >= 1 Then ratus = TerBilang(Mid(aaa, 7, 3)) + " rupiah" End If tAngka2Text = HilangkanSpaceDouble(Trim(juta + ribu + ratus)) Angka2Text = "#" & tAngka2Text & "#" 'UCase (Left(tAngka2Text, 1)) + Right(tAngka2Text, Len(tAngka2Text) - 1) End Function Function TerBilang(txt) As String Dim huruf As String huruf = " " 'huruf ratusan If Left(txt, 1) = "1" Then huruf = "seratus" Else If Left(txt, 1) = " " Or Left(txt, 1) = "0" Then huruf = "" Else huruf = satuan(Val(Left(txt, 1))) + " ratus" End If End If 'huruf puluhan dan satuan If Mid(txt, 2, 1) = "1" Then If Mid(txt, 2, 2) = "10" Then huruf = huruf + " sepuluh" ElseIf Right(txt, 2) = "11" Then huruf = huruf + " sebelas" Else huruf = huruf + " " + satuan(Val(Right(txt, 1))) + " belas" End If Else If Mid(txt, 2, 1) = "0" Or Mid(txt, 2, 1) = " " Then huruf = huruf + " " + satuan(Val(Right(txt, 1))) Else huruf = huruf + " " + satuan(Val(Mid(txt, 2, 1))) + " puluh" huruf = huruf + " " + satuan(Val(Right(txt, 1))) End If End If TerBilang = huruf End Function Function HilangkanSpaceDouble(S) Dim x As Byte Dim a As String Dim Tanda As Boolean Dim Hrf As String Hrf = Mid(S, 1, 1) For x = 2 To Len(S) a = Mid(S, x, 1) If a = " " And Mid(S, x - 1, 1) = " " Then Tanda = True Else Tanda = False End If If Not Tanda Then Hrf = Hrf + a End If Next x HilangkanSpaceDouble = Hrf End Function