I come from a C# background and I'm trying to port some C# code to VBA for use in an excel file.
I have a function that takes a type (many properties) and should do some work on it. Here's a snippet of the code:
Public Function CalculateThrust(ByVal PumpParams As PumpParameters) As AxialThrustValues
Dim statVars As StaticVariables
Set statVars = New StaticVariables
statVars.Init (PumpParams)
'empty return obj provision
Dim ret As AxialThrustValues
Set ret = New AxialThrustValues
If PumpParams.NumberOfStages > 3 Then
ret.AxialThrust = -1 * statVars.FAES
My problem is that when I debug, it jumps right to the last variable "FAES" and says:
"Compile error: Method or data member not found"
Maybe I'm missing something with the VBA language but, my though process would be that the function should evaluate as such:
- Take "PumpParams" parameter input
- Use "PumpParams" to instantiate statVars object
- Be able to access statVars.FAES because the object has been instantiated...
Any ideas to help me get past this roadblock would be very much appreciated, thanks.
Snippet of the StaticVariables class:
Private InputParameters As PumpParameters
Public Sub Init(InputParameters As PumpParameters)
InputParameters = PumpParameters
setPropsInitial
setConditionals
End Sub
Public GAM, VISCOS, OMEGA, U2S, U2N, FMS, FMN, CAES, CAHS, CAEN, CAHN, P1S, PST, FAES, FAHS, FAEN, FAHN, FATB, FAIB, PCB, FACB, FAHDCB, FAHSCB, PHDE, PHSE As Double
Private Sub setPropsInitial()
FAES = CalcForcesAtImpEye(InputParameters.SuctionImpDia, InputParameters.SuctionStageEyeRingDia, P1S, GAM, U2S, CAES, FMS)...