一些vba代码
#####################
#####################
#####################
#####################
#####################
#####################
#####################
#####################
在写函数时,报错的绝大部分原因是没有正确的引用系统的函数。
#####################
#####################
#####################
#####################
#####################
#####################
Public Function OrientationFactor(theta As Double, X As Double, Y As Double, S As Double)
Dim temp, m, n As Double
theta = Application.Radians(theta)
m = Cos(theta)
n = Sin(theta)
Debug.Print (m)
temp = (Application.Power(m, 4) - m * m * n * n) / X / X _
+ Application.Power(n, 4) / Y / Y + (m * m * n * n) / S / S
temp = Application.Power(temp, 0.5)
OrientationFactor = temp
End Function