2
在我的Excel的VBA程序中;我有一個名爲「ParamCheck」的函數,它會得到四個「double」變量,檢查它們並以「string」的形式返回一條消息。當在VBA Excel中調用子函數時,「Object Required」
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
現在我需要在我的子程序中調用這個函數。運行它給我這個錯誤「所需的對象」,並強調「checkParam」
非常感謝...我刪除了'設置',它只是工作 – user1143529 2013-05-07 22:50:53