从 Excel 的 VBA 调用加载项函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3063441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Calling a Add-in function from Excel's VBA
提问by graham
I am using an Excel Add-in for an Erlangs: http://abstractmicro.com/erlang/helppages/ref-erlbblockage.htm
我正在为 Erlangs 使用 Excel 插件:http: //abstractmicro.com/erlang/helppages/ref-erlbblockage.htm
I try to call the Erlang-B function within the Add-in from within VBA thus:
我尝试从 VBA 中调用加载项中的 Erlang-B 函数,因此:
Function Erl(Erlangs As Double, Capacity As Double)
Erl = Application.WorksheetFunction.ErlbBlockage(Capacity, Erlangs)
End Function
...but it doesn't work. I get #VALUE!
returned in the Excel cell.
I think it is because the function is not part of standard Excel (it is in the Add-in). So how do I call it?
......但它不起作用。我#VALUE!
在 Excel 单元格中返回。我认为这是因为该函数不是标准 Excel 的一部分(它在加载项中)。那我怎么称呼呢?
回答by Charles Williams
Try setting a reference in your VBA project to the Erlang Addin
VBE-->Tools-->References check A_Erlang
尝试在您的 VBA 项目中设置对 Erlang Addin
VBE-->Tools-->References check A_Erlang 的引用
Then you can call the functions in the addin directly from VBA
然后你可以直接从 VBA 调用插件中的函数
Myvar = ErlbBlockage(capacity, erlangs)