Function Units Class

AddPrefix

"Add Prefix Definition" Add a prefix such as "kilo" into the units conversion program table, or replace an existing definition. Prefixes can be used to modify any of the known units within measurement expressions. Function returns an empty string upon success. Function returns the error message as a string when errors occur.

Signature (Visual Basic / VBA)

Public Function AddPrefix( _
      ByVal vCode As String _
    , ByVal vName As String _
    , ByVal vValue As Double _
    ) As String

Code Examples

    estConvertAddPrefix("k", "kilo", 1000)
    estConvertAddPrefix("mega", "", 1000000)

Return Value

Function returns an empty string upon success. It returns the error message as a string when errors occur within the function. If there is already a prefix definition with the same Code, that previous definition will be overwritten by the new one. defines the prefix "k" named "kilo" with a multiplier value of 1,000. defines the prefix "mega" named "mega" with a multiplier value of 1,000,000.

Notes & Version History

Arguments vCode is the code or unique identifier of the prefix. vName is the name and/or description of the prefix. When vName is blank, vCode is used as the Name. vValue is the multiplier value of the prefix.