<-- Previous || Up || Next -->

Convert Special Function
Units Class

Public Function ConvertSpecial( _
      ByVal vFromExpr As Variant _
    , ByVal vToMajorUnit As Variant _
    , ByVal vToMinorUnit As Variant _
    , ByVal vPrecision As Variant _
    , ByVal vAsFraction As Variant _
    ) As Variant

"Special Convert Measurement" Perform measurement conversions to and/or from combinations of major and minor units. Also supports the input and output of fractional numbers and the rounding of results.

Remarks: Converts "to" and "from" measurements which involve combinations of major and minor units. For example, converts from "12 feet 2 inches" to "meters". Includes options for expressing results in terms of major and/or minor units. For example, converts from "2 meters" to "feet and inches". Includes options for rounding the result to a specific precision and for representing the result as a fraction.
Arguments: vFm is a string containing one or more measurement expressions which represent the same type of physical measurement. vToMajor (and optionally vToMinor) name the measurements into which the vFm measurement expressions will be converted. When vToMajor is non-blank and vToMinor is blank, the vFm measurement expression will be converted to the vToMajor measurement. When both vToMajor and vToMinor are non-blank, the vFm measurement expression will be converted to the vToMajor units--the integer part will be expressed in terms of the vToMajor unit and the fractional part is expressed in terms of the vToMinor units. When vPrecision is numeric, the fractional part of the converted measurement is rounded to the nearest 1 / vPrecision. The fractional part of the result (if any) is expressed in decimal form when vAsFraction is False or as a fraction when vAsFraction is non-False.
Return Value: The function returns a numeric result when the vToMinor is blank and vAsFraction is False. It returns a measurement expression as a string in most other cases. When errors occur, the error message is returned as a string of the form "Error: ...."
Sample conversions supported by this function:
       32' 11 15/16" to 32.994791666 ft
       32' 11 15/16" to 10.05681247 m
       32.994791 ft to 32' 11 15/16"
       10.05681247 m to 32' 11 15/16"
Examples:
    estConvertSpecial("3.4567m", "'", "", 64, True)
converts 3.4567 meters to feet, rounding the result to the nearest 64th of a foot--it returns "11 11/32"
    estConvertSpecial("3.4567m", "'", "", 64, False)
performs the same conversion but returns the result in decimal form--it returns 11.34375.
    estConvertSpecial("3.4567m", "'", """", 64, True)
converts 3.4567 meters to feet and inches, rounding the result to the nearest 64th of an inch--it returns "11' 4 3/32"""
    estConvertSpecial("3.4567m", "'", """", 64, False)
performs the same conversion but returns the result in decimal form--it returns "11' 4.09375"""
    estConvertSpecial("11' 11 15/16""", "m", Null, Null, Null)
converts 11 feet and 11 15/16 inches to meters, returning 3.6560125.
See Also:
    Convert Function
    ConvertString Function

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.