Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modMathAreaVolume module. |
AreaOfCircle | Procedure | Get the area of a circle. |
AreaOfRectangle | Procedure | Get the area of a rectangle. |
AreaOfRing | Procedure | Get the area of a ring. |
AreaOfSphere | Procedure | Get the surface area of a sphere. |
AreaOfSquare | Procedure | Get the area of a square based on the length of a side. |
AreaOfSquareDiag | Procedure | Get the area of a square based on its diagonal length. |
AreaOfTrapezoid | Procedure | Get the area of a trapezoid. |
AreaOfTriangle | Procedure | Get the area of a triangle based on the base length and height. |
AreaOfTriangle2 | Procedure | Get the area of a triangle based on the length of its sides. |
LenOfRectangleDiagonal | Procedure | Get the length of the diagonal of a rectangle. |
LenOfSquareDiagonal | Procedure | Get the length of the diagonal of a square. |
VolOfCone | Procedure | Get the volume of a cone. |
VolOfCylinder | Procedure | Get the volume of a cylinder. |
VolOfPipe | Procedure | Get the volume of a pipe. |
VolOfPyramid | Procedure | Get the volume of a pyramid or cone. |
VolOfSphere | Procedure | Get the volume of a sphere. |
VolOfTruncPyramid | Procedure | Get the volume of a truncated pyramid. |
' Example of modMathAreaVolume ' ' To use this example, create a new module and paste this code into it. ' Then run the procedures 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_modMathAreaVolume() ' Comments: Examples of using the modMathAreaVolume module to calculate the area and volume of various objects in VBA and VB6. Dim dblTmp As Double Dim dblTmp2 As Double Dim dblTmp3 As Double dblTmp = 12 dblTmp2 = 3.2 dblTmp3 = 4.2 Debug.Print "Area of a Circle with radius of " & dblTmp & " is: " & AreaOfCircle(dblTmp) Debug.Print "Area of a Rectangle with side lengths of " & dblTmp & " and " & dblTmp2 & " is: " & AreaOfRectangle(dblTmp, dblTmp2) Debug.Print "Area of a Ring with inner and outer radiuses of " & dblTmp2 & " and " & dblTmp & " is: " & AreaOfRing(dblTmp2, dblTmp) Debug.Print "Surface area of a Sphere with radius of " & dblTmp & " is: " & AreaOfSphere(dblTmp) Debug.Print "Area of a Square with side length " & dblTmp & " is: " & AreaOfSquare(dblTmp) Debug.Print "Area of a Square with a diagonal length of " & dblTmp & " is: " & AreaOfSquareDiag(dblTmp) Debug.Print "Area of a Trapezoid with height " & dblTmp & " and side lengths " & dblTmp2 & " and " & dblTmp3 & " is: " & AreaOfTrapezoid(dblTmp, dblTmp2, dblTmp3) Debug.Print "Area of a Triangle with a base length " & dblTmp & " and height " & dblTmp2 & " is: " & AreaOfTriangle(dblTmp, dblTmp) dblTmp = 3 dblTmp2 = 4 dblTmp3 = 5 Debug.Print "Area of Triangle with side lengths of " & dblTmp & ", " & dblTmp2 & ", and " & dblTmp3 & " is: " & AreaOfTriangle2(dblTmp, dblTmp2, dblTmp3) Debug.Print Debug.Print "Length of a Square Diagonal with side of " & dblTmp & " is: " & LenOfSquareDiagonal(dblTmp) Debug.Print "Length of a Rectangle Diagonal with side lengths of " & dblTmp & " and " & dblTmp2 & " is: " & LenOfRectangleDiagonal(dblTmp, dblTmp2) Debug.Print Debug.Print "Volume of a Cone with height of " & dblTmp & " and radius of " & dblTmp2 & " is: " & VolOfCone(dblTmp, dblTmp2) Debug.Print "Volume of a Cylinder with height of " & dblTmp & " and radius of " & dblTmp2 & " is: " & VolOfCylinder(dblTmp, dblTmp2) Debug.Print "Volume of a Pipe with height of " & dblTmp & " and inner and outer radius of " & dblTmp3 & " and " & dblTmp2 & " is: " & VolOfPipe(dblTmp, dblTmp3, dblTmp2) Debug.Print "Volume of a Sphere with radius " & dblTmp & " is: " & VolOfSphere(dblTmp) Debug.Print "Volume of a Pyramid with height of " & dblTmp & " and base area of " & dblTmp2 & " is: " & VolOfPyramid(dblTmp, dblTmp2) Debug.Print "Volume of a Truncated Pyramid with height of " & dblTmp & " and bottom and top areas of " & dblTmp2 & " and " & dblTmp3 & " is: " & VolOfTruncPyramid(dblTmp, dblTmp2, dblTmp3) 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