下面的代码定义了一个简单的Sum函数:
Dim Code As string
Code = "Dim
Val1 As Integer = 1"
&
vbcrlf
Code =
Code
&
"Dim Val2 As Integer = 2"
&
vbcrlf
Code =
Code
&
"Dim Sum As Integer = Val1 + Val2"
&
vbcrlf
Code =
Code
&
"Return Sum"
Functions.Add("Sum",Code)
Functions.Complie()
这样我们就可以在其余地方调用此函数:
Functions.Execute("Sum")
这是帮助文档的自定义函数 结果提示 具有相同的项 错误代码:自定义函数SUM
不太懂 刚学。。。。。。。