DataFunctions.ConvertMoneyStringToNumber Method

The ConvertMoneyStringToNumber method converts the specified string as money, based on the specified locale. If successful, ConvertMoneyStringToNumber returns a number that represents the value of the specified string in the base monetary unit of the specified locale; otherwise, Null.

Syntax

DataFunctions.ConvertMoneyStringToNumber(Money, Locale)

Parameters

Money
A string representation of the money to convert.
Locale
Optional. This number specifies the locale to use to convert the string. For a list of valid locale values, see Hexadecimal Locale Identifiers. If this parameter is not specified, the value of the DataFunctions object’s Locale parameter is used.

Remarks

The ConvertMoneyStringToNumber method returns the value in the base monetary unit for a given locale. Thus, given a value in dollars, ConvertMoneyStringToNumber returns the number of cents in the dollar value.

Additionally, ConvertMoneyStringToNumber does not round values. For example, if you pass this method “123.009” the method returns 12300, not 12301.

This method returns a Variant of type Long, not an OLE currency type.

Warning

In some cases, the DataFunctions.ConvertMoneyStringToNumber method returns NULL when converting a string representation of monetary value to the Currency VARIANT type for Swedish and Portuguese Standard locales. To avoid this problem, use the Microsoft® Visual Basic® Scripting Edition (VBScript) function Replace(MoneyString, CurrencyDigitGroupingSymbol,"") to remove the currency digit grouping symbol from the money string prior to call to ConvertMoneyStringToNumber.

Related Topics


© 1997-1998 Microsoft Corporation. All rights reserved.