Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modUnitConversion module. |
CelsiusToFahrenheit | Procedure | Converts from Celsius (centigrade) to Fahrenheit. |
ComputeWindChillEnglish | Procedure | Calculate the wind chill for exposed human skin. |
ComputeWindChillMetric | Procedure | Calculate the wind chill for exposed human skin. |
ConvertDistance | Procedure | Converts between distance units. This function first normalizes metric and English values to meters, then multiplies by the conversion factor for meters. |
ConvertVolume | Procedure | Converts between volume units. This function first normalizes metric and English values to liters, then multiplies by the conversion factor for liters. |
ConvertWeight | Procedure | Converts between weight units. The function normalizes metric and English values to grams, then multiplies by the conversion factor for grams. |
DegreesToRadians | Procedure | Convert degrees to radians (180 degrees equals PI radians). |
FahrenheitToCelcius | Procedure | Converts Fahrenheit to Celsius (centigrade). |
JulianDateToGregorianDate | Procedure | Get a standard Gregorian Date from a Julian Date. The Gregorian calendar is our traditional calendar and is named for Pope Gregory XIII, who made it the official calendar in the 16th century. Julian Day is the number of days in the current year starting with January 1. Julian Date is a five or seven digit number with the first two or four digits being the year followed by the three digit Julian Day. |
GregorianDateToJulianDate | Procedure | Get a Julian Date from a Gregorian Date. The Gregorian calendar is our traditional calendar and is named for Pope Gregory XIII, who made it the official calendar in the 16th century. Julian Day is the number of days in the current year starting with January 1. Julian Date is a five or seven digit number with the first two or four digits being the year followed by the three digit Julian Day. |
YearWithoutCentury | Procedure | For a given year greater than zero, remove the century for a two digit year (with leading 0 if necessary). |
GregorianDateToJulianDay | Procedure | Calculate the Julian Day for a Gregorian Date. The Gregorian calendar is our traditional calendar and is named for Pope Gregory XIII, who made it the official calendar in the 16th century. Julian Day is the number of days in the current year starting with January 1. |
RadiansToDegrees | Procedure | Convert radians to degrees (PI radians equals 180 degrees). |
' Example of modUnitConversion ' ' To use this example, create a new module and paste this code into it. ' Then run the procedure by putting the cursor in the procedure and pressing: ' F5 to run it, or ' F8 to step through it line-by-line (see the Debug menu for more options) Private Sub Example_modUnitConversion() ' Comments: Examples of the modUnitConversion module to convert units of measurement such as degrees, distance, volume, and calendar dates in VBA and VB6. Debug.Print "Converting temperature:" Debug.Print "100 degrees Celsius is " & CelsiusToFahrenheit(100) & " Fahrenheit" Debug.Print "72 degrees Fahrenheit is " & FahrenheitToCelcius(72) & " Celsius" Debug.Print "Wind chill for 40 degrees (F) and 30 MPH winds is: " & ComputeWindChillEnglish(40, 30) Debug.Print "Wind chill for 10 degrees (C) and 60 KPH winds is: " & ComputeWindChillMetric(10, 60) Debug.Print Debug.Print "Converting Distance:" Debug.Print "12 inches is " & ConvertDistance(12, cvdiInches, cvdiDecameters) & " decameters." Debug.Print "3 decameters is " & ConvertDistance(3, cvdiDecameters, cvdiInches) & " inches." Debug.Print Debug.Print "Converting Volume:" Debug.Print "9 gallons is " & ConvertVolume(9, cvvoGallons, cvvoliters) & " liters." Debug.Print "9 liters is " & ConvertVolume(9, cvvoliters, cvvoGallons) & " gallons." Debug.Print Debug.Print "Converting Weight:" Debug.Print "13 pounds is " & ConvertWeight(13, cvwePounds, cvweKilograms) & " kilograms." Debug.Print "1000 kilograms is " & ConvertWeight(1000, cvweKilograms, cvwePounds) & " pounds." Debug.Print Debug.Print "Converting Degrees:" Debug.Print "45 degrees is " & DegreesToRadians(45) & " radians." Debug.Print "92 radians is " & RadiansToDegrees(92) Debug.Print Debug.Print "Converting Dates:" Debug.Print "Julian Day for today is: " & GregorianDateToJulianDay(Date) Debug.Print "4 digit year, Julian Date for today is: " & GregorianDateToJulianDate(Now) Debug.Print "2 digit year, Julian Date for today is: " & GregorianDateToJulianDate(Now, False) Debug.Print Debug.Print "Gregorian Date for 4 digit year 2014295 is: " & JulianDateToGregorianDate(2014295) Debug.Print "Gregorian Date for 2 digit year 14295 is: " & JulianDateToGregorianDate(14295, False) Debug.Print "Gregorian Date for 2 digit year 14295 for 1900's is: " & JulianDateToGregorianDate(14295, False, 19) End Sub
The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."
Van T. Dinh, Microsoft MVP