I am attempting to print out my own checks using the information I keep in Base. So currently I have a form with a table control that shows vendor name, amount the check needs to be written for, etc. I am making good progress on everything except for getting a macro to automatically convert a field of numbers (the amount to pay) into a field of text (i.e. $300.00 to three hundred dollars and zero cents)
I found this code for converting numbers into text dollars (it is for a specific amount 4234.07)
Code: Select all
Sub Main
Print NumToDollars( 4234.07 )
End Sub
Function NumToDollars( ByVal nNumber As Double ) As String
cWords = ""
nDollars = Int( nNumber )
nCents = Int( (nNumber - Int( nNumber ) + 0.005) * 100 )
cDollars = NumToWords( nDollars )
cCents = CSTR( nCents )
If Len( cCents ) < 2 Then
cCents = "0" & cCents
EndIf
cWords = cDollars & " Dollars and " & cCents & " Cents"
NumToDollars() = cWords
End Function
Thanks!
TJM05