【问题标题】:can i run c# code from vba macro?我可以从 vba 宏运行 c# 代码吗?
【发布时间】:2010-06-06 22:47:03
【问题描述】:

是否可以在 VBA 中包含某种库,使我能够使用我编写的 c# 函数?

【问题讨论】:

  • 请给我一些代码而不是给我链接
  • 你点击了链接吗?

标签: c# vba


【解决方案1】:

您需要使用 [ComVisible] 属性向 COM 公开托管代码。

有关详细信息,请参阅here。

编辑:例如:

[ComVisible(true)]
public class MyClass {
    public int GetNumber(string name) { ... }
}

【讨论】:

    【解决方案2】:

    您需要使用ComVisible 属性。 这是similar question

    【讨论】:

      猜你喜欢
      • 2013-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-11
      • 1970-01-01
      • 2015-07-22
      相关资源
      最近更新 更多