Public Function NormalKa(a1 As Double, a2 As Double, a3 As Double, a4 As Double) As Double
    Dim b1, b2, b3, b4 As Double
    Dim temp1, temp2, temp3, temp4 As Double
    b1 = A_H(90# - a1)
    b2 = A_H(a2)
    b3 = A_H(a3)
    b4 = A_H(a4)
                    '化为弧度a的顺序为墙背与水平面夹角,填土表面与水平面的夹角,墙背与填土之间的摩擦角,回填土内摩擦角
    temp1 = (Cos(b4 - b1)) ^ 2
    temp2 = (Cos(b1)) ^ 2 * Cos(b1 + b3)
    temp3 = Sin(b3 + b4) * Sin(b4 - b2) / Cos(b1 + b3) / Cos(b1 - b2)
    temp4 = (1 + temp3 ^ 0.5) ^ 2
    
    NormalKa = temp1 / temp2 / temp4
End Function

解决方案 »

  1.   

    调用是这样的:
     Dim a1, a2, a3, a4 As Double
        
        a1 = CDbl(Text1.Text)
        a2 = CDbl(Text2.Text)
        a3 = CDbl(Text3.Text)
        a4 = CDbl(Text4.Text)
        
        Dim result As Double
        result = NormalKa(a1, a2, a3, a4)
      

  2.   

    Dim b1, b2, b3, b4 As Double
    Dim temp1, temp2, temp3, temp4 As Double改掉dim b1 as double
    dim b2 as double
    dim b3 as double
    dim b4 as doubledim temp1 as double
    dim temp2 as double
    dim temp3 as double
    dim temp4 as double
    函数内部没有什么大的错误,你把调用的地方贴上来看看。
      

  3.   

    Dim a1, a2, a3, a4 As Double
    改成
    dim a1 as double
    dim a2 as double
    dim a3 as double
    dim a4 as double
      

  4.   

    Public Function NormalKa(a1 As Double, a2 As Double, a3 As Double, a4 As Double) As Double
    函数说明改为
    Public Function NormalKa(byval a1 As Double, byval a2 As Double, byval a3 As Double, byval a4 As Double) As Double
      

  5.   

    把a1,a2,a3,a4 改了就可以了是为什么??
      

  6.   

    Dim a1, a2, a3, a4 As Double
    不等价与
    Dim a1 As Double, a2 As Double, a3 As Double, a4 As Double等价于
    Dim a1 as Variant, a2 as Variant, a3 as Variant, a4 As Double
      

  7.   

    byref为引用传递,它为缺省的方式,而byval为值传递,