Maybe try this?
Function ConvertOMRToWords(ByVal OMR As Double) As String ' Converts Omani Rial (OMR) currency numbers to words. ' Handles up to 999,999.999 OMR. Dim RialPart As Long Dim BaisaPart As Long Dim Words As String ' Separate Rial and Baisa parts RialPart = Int(OMR) BaisaPart = Round((OMR - RialPart) * 1000, 0) ' Round to 3 decimal places for Baisa ' Convert Rial part If RialPart > 0 Then Words = ConvertNumberToWords(RialPart) & " Omani Rial" End If ' Convert Baisa part If BaisaPart > 0 Then If RialPart > 0 Then Words = Words & " and " End If Words = Words & ConvertNumberToWords(BaisaPart) & " Baisa" End If ' Handle zero case If IsEmpty(Words) Then Words = "Zero Omani Rial" End If ConvertOMRToWords = Words End Function Function ConvertNumberToWords(ByVal Number As Long) As String ' Converts a number to words (helper function). Dim Ones(19) As String Dim Tens(9) As String Dim Hundreds As String Dim Thousands As String Dim Millions As String Dim Billions As String Dim Words As String On Error GoTo ErrorHandler Ones(0) = "" Ones(1) = "One" Ones(2) = "Two" Ones(3) = "Three" Ones(4) = "Four" Ones(5) = "Five" Ones(6) = "Six" Ones(7) = "Seven" Ones(8) = "Eight" Ones(9) = "Nine" Ones(10) = "Ten" Ones(11) = "Eleven" Ones(12) = "Twelve" Ones(13) = "Thirteen" Ones(14) = "Fourteen" Ones(15) = "Fifteen" Ones(16) = "Sixteen" Ones(17) = "Seventeen" Ones(18) = "Eighteen" Ones(19) = "Nineteen" Tens(2) = "Twenty" Tens(3) = "Thirty" Tens(4) = "Forty" Tens(5) = "Fifty" Tens(6) = "Sixty" Tens(7) = "Seventy" Tens(8) = "Eighty" Tens(9) = "Ninety" If Number = 0 Then ConvertNumberToWords = "" ' Handle zero case within this function. Exit Function End If If Number >= 1000000000 Then Billions = ConvertNumberToWords(Number \ 1000000000) & " Billion " Number = Number Mod 1000000000 End If If Number >= 1000000 Then Millions = ConvertNumberToWords(Number \ 1000000) & " Million " Number = Number Mod 1000000 End If If Number >= 1000 Then Thousands = ConvertNumberToWords(Number \ 1000) & " Thousand " Number = Number Mod 1000 End If If Number >= 100 Then Hundreds = Ones(Number \ 100) & " Hundred " Number = Number Mod 100 End If If Number >= 20 Then Words = Tens(Number \ 10) Number = Number Mod 10 End if If Number > 0 Then Words = Words & " " & Ones(Number) End If If Number > 0 Then Words = Ones(Number) End If ConvertNumberToWords = Billions & Millions & Thousands & Hundreds & Words Exit Function ErrorHandler: ConvertNumberToWords = "Error" End Function