如何使用 VBA 将 System.Windows.Forms.Panel 放入 Excel 文档中?
我有一个用 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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将 ComVisible 属性设置为 true(默认为 false)
检查您的
AssemblyInfo.cs
You need to set the ComVisible Attribute to true (default is false)
check your
AssemblyInfo.cs