如何使用 VBA 将 System.Windows.Forms.Panel 放入 Excel 文档中?

发布于 2024-12-11 00:35:45 字数 317 浏览 0 评论 0原文

我有一个用 C# 编写的可视组件,它扩展了 System.Windows.Forms.Panel,如果需要,我可以将其更改为 System.Windows.Forms.Control 或类似组件。

我有一个使用 VBA 在 Excel 2005 文档中编写为宏的应用程序。

我想以某种方式将我的 C# (.NET) 控件放入 VBA 应用程序中,但我找不到任何解决方案。

我尝试使用 COM 来做到这一点并设法创建对象,但我找不到任何方法使它们可见。我应该实现一些 OLE 接口吗?找不到有关如何在 .NET 中创建 OLE 对象的任何信息。

我缺少什么?

I have a visual component written in C# that extends a System.Windows.Forms.Panel, I can change this to System.Windows.Forms.Control or similar if needed.

I have an application written as macros in an Excel 2005 document using VBA.

I want to put my C# (.NET) control in the VBA application in some way, but I can't find any solution.

I have tried to do it using COM and managed to create objects but I can't find any way to make them visible. Should I implement some OLE interface? Can't find anything about how to create an OLE object in .NET.

What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自我难过 2024-12-18 00:35:45

您需要将 ComVisible 属性设置为 true(默认为 false)

[assembly: ComVisible(false)]

检查您的 AssemblyInfo.cs

You need to set the ComVisible Attribute to true (default is false)

[assembly: ComVisible(false)]

check your AssemblyInfo.cs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文