VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Six

by Sehul Soni (OraSe) (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 10th March 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Sixty Seven Paise Only.

API Declarations


' Wait and Surf vbcode
' Many More thing will be come in very short time.


Rate Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Six



' Author Name : Sehul Soni
' E-Mail Id   : [email protected],[email protected]
' Study       : MCA (IGNOU)

Public Function NToWordEn(ByVal Amt As String)
    Dim InWord As String
    Dim no As String
    Dim i, j As Integer
    Dim Con(90) As String
    Dim No2 As Integer

    InWord = IIf(CDbl(Amt) >= 1, "Rupees", "")
    
    Con(1) = "One"
    Con(2) = "Two"
    Con(3) = "Three"
    Con(4) = "Four"
    Con(5) = "Five"
    Con(6) = "Six"
    Con(7) = "Seven"
    Con(8) = "Eight"
    Con(9) = "Nine"
    Con(10) = "Ten"
    Con(11) = "Eleven"
    Con(12) = "Twelve"
    Con(13) = "Thirteen"
    Con(14) = "Fourteen"
    Con(15) = "Fifteen"
    Con(16) = "Sixteen"
    Con(17) = "Seventeen"
    Con(18) = "Eighteen"
    Con(19) = "Nineteen"
    Con(20) = "Twenty"
    Con(30) = "Thirty"
    Con(40) = "Fourty"
    Con(50) = "Fifty"
    Con(60) = "Sixty"
    Con(70) = "Seventy"
    Con(80) = "Eighty"
    Con(90) = "Ninety"
    
    'Convertion for Rupees
    For i = 1 To 5
        If i <= 3 Then
            no = Mid(Amt, (i * 2) - 1, 2)
        ElseIf i = 4 Then
            no = Mid(Amt, 7, 1)
        ElseIf i = 5 Then
            no = Mid(Amt, 8, 2)
        End If

        If CInt(Trim(no)) > 0 Then
            
            If CInt(Trim(no)) < 20 Then
                InWord = InWord + " " + Con(no)
            Else
                For j = 1 To 2
                    No2 = CInt(Trim(Mid(no, j, 1)))
                    If j = 1 Then No2 = No2 * 10
                    InWord = InWord + " " + Con(str(No2))
                Next
            End If
        
            Select Case i
                Case 1
                    InWord = InWord + " " + "Crore"
                Case 2
                    InWord = InWord + " " + "Lakh"
                Case 3
                    InWord = InWord + " " + "Thousand"
                Case 4
                    InWord = InWord + " " + "Hundred"
            End Select
        End If
    Next
    
    'Convertion for Paise
    If (CDbl(Mid(Amt, 1, 9)) > 0 And CInt(Right(Amt, 2)) <> 0) Then InWord = InWord + " " + "And"
    
    If CInt(Right(Amt, 2)) > 0 Then
        If CInt(Right(Amt, 2)) < 20 Then
            InWord = InWord + " " + Con(Right(Amt, 2))
        Else
            For j = 1 To 2
                No2 = CInt(Trim(Mid(Right(Amt, 2), j, 1)))
                If j = 1 Then No2 = No2 * 10
                InWord = InWord + " " + Con(str(No2))
            Next
        End If
        InWord = InWord + " " + "Paise"
    End If
    NToWordEn = InWord + " " + "Only"
End Function

Download this snippet    Add to My Saved Code

Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Six Comments

No comments have been posted about Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Six. Why not be the first to post a comment about Convert Number in word. e.g. 10345.67 will convert in Ten Thousand Three Hundred Forty Five and Six.

Post your comment

Subject:
Message:
0/1000 characters