Create an ActiveX DLL project (SceedaUtility). Add a new Class module (CSceeda). Add the following code to the class:
Code:
Option Explicit
Public Math As CMath
Private Sub Class_Initialize()
Set Math = New CMath
End Sub
In the Properties Window, set the CSceeda class' Instancing property to MultiUse or GlobalMultiUse.
Now add a second Class module to the project (CMath). Add the following code to the class:
Code:
Option Explicit
Public Function CalculateAverage(Values() As Double) As Double
Dim Result As Double
' Calculate average here
CalculateAverage = Result
End Function
Set this class' Instancing property to PublicNotCreatable. Compile the project to build the DLL.
Finally, open or create the client project. Set a reference to your new SceedaUtility DLL. In your client code, do this:
Code:
Dim Sceeda As CSceeda
Set Sceeda = New CSceeda
Dim Values(4) As Double
Dim Average As Double
Average = Sceeda.Math.CalculateAverage(Values)
Bookmarks