在我的excel VBA程序中;我有一个名为“ParamCheck”的函数,它获取四个“双”变量,检查它们并将消息作为“字符串”返回。
Function ParamCheck(airSpeed As Double, FCUvalue As Double, _
altitude As Double, terrainElevation As Double) As String
If airSpeed < MIN_CONTROL_SPEED Then
'check if airspeed is less than 119 ft/min or not
ParamCheck = "Airspeed is less than minimum control speed"
ElseIf FCUvalue > FCU_VALUE_LIMIT Then
'check if FCU value if greater than 10 or not
ParamCheck = "FCU value is greater than limit"
ElseIf FCUvalue < 0 Then
'check if FCU vlaue is negative or not
ParamCheck = "FCU value is negative"
ElseIf altitude <= terrainElevation Then
'check if altitude is greater that terrain of elevation or not
ParamCheck = "Altitude is less than terrain elevation"
Else
'if all the parameters are valid print a "Valid" message
ParamCheck = PARAMS_OK
End If
End Function
现在我需要在我的子程序中调用这个函数。这是代码
Dim checkParam As String ' result of validity check of parameters
Set checkParam = ParamCheck(speedAir, valueFCU, aboveSea, elevationTerrain)
运行时它给我这个错误“需要对象”并突出显示“checkParam”