Convert Expression to Currency Method

The Convert Expression to Currency method converts the value that the expression argument contains to a currency. It returns this currency. Note the following:

  • A number that does not fit in the currency data type causes an Overflow error.

  • A string that cannot convert to a currency causes a Type Mismatch error.

  • A variant that contains a null result causes an Illegal Use of Null error.

For more information, see Overview of Data Types.

Format

CCur(expression)

For information about the arguments that you can use with this method, see Argument That You Can Use with Conversion Methods.

Example

The following example converts a yearly payment on a loan to a currency value with four decimal places. A subsequent Format statement formats the value to two decimal places before displaying it in a message box:

Sub Button_Click
Dim aprate, totalpay, loanpv
Dim loanfv, due, monthlypay
Dim yearlypay, msgtext
loanpv = 5000
aprate = 6.9
If aprate >1 then
aprate = aprate/100
End If
aprate = aprate/12
totalpay = 360
loanfv = 0
Rem Assume payments are made at end of month
due = 0
monthlypay = Pmt(aprate,totalpay,-loanpv,loanfv,due)
yearlypay = CCur(monthlypay * 12)
msgtext = "The yearly payment is: " _
;Format(yearlypay, "Currency")
End Sub