vba 寻找仅 32 位 Microsoft 通用控件 (ListView) 的替代品
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16792410/
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
Looking for alternatives to 32-bit only Microsoft Common Controls (ListView)
提问by assylias
I have a legacy application developed in VBA/Excel which uses ListView controls. Unfortunately, it looks like these controls can't be used with 64-bit versions of Excel:
我有一个在 VBA/Excel 中开发的遗留应用程序,它使用 ListView 控件。不幸的是,这些控件似乎无法与 64 位版本的 Excel 一起使用:
Native 64-bit processes in Office 2010 cannot load 32-bit binaries. This includes the common controls of MSComCtl [such as ListViews]. An alternative must be found for existing Microsoft Office VBA solutions that utilize these controls when the code is migrated to 64-bit Office 2010.
Office 2010 中的本机 64 位进程无法加载 32 位二进制文件。这包括 MSComCtl 的常用控件 [例如 ListViews]。当代码迁移到 64 位 Office 2010 时,必须为使用这些控件的现有 Microsoft Office VBA 解决方案找到替代方案。
I need to migrate that legacy application to Excel 2010/13 x64. The process is mostly painless except for those ListView
controls.
我需要将该旧应用程序迁移到 Excel 2010/13 x64。除了那些ListView
控制之外,这个过程几乎是无痛的。
What are my main options to replace the ListView
control and which would be the most effective (from a time&difficulty to implement perspective)?
我替换ListView
控件的主要选项是什么,哪些是最有效的(从时间和实施的角度来看)?
Notes:
笔记:
- This issue has been raised on MS forumsbut no practical answer has been given.
- adding
.net
tag as I suspect some solutions could come from there.
- 这个问题已在MS 论坛上提出,但没有给出实际答案。
- 添加
.net
标签,因为我怀疑一些解决方案可能来自那里。
To make it clearer, here is a snapshot of the Excel user form. The bottom part is the list view (I have hidden confidential information), which has sortable column, allows the user to select multiple, non-consecutive, lines.
为了更清楚,这里是 Excel 用户表单的快照。底部是列表视图(我隐藏了机密信息),它具有可排序的列,允许用户选择多个不连续的行。
回答by confusopoly
One thing that is theoretically possible would be to write your display code as a .Net assembly and access that via COM from your VBA code (see for example How can I make use of .NET objects from within Excel VBA?as a starting point for how to do this).
理论上可行的一件事是将您的显示代码编写为 .Net 程序集并通过 COM 从您的 VBA 代码中访问它(参见例如如何从 Excel VBA 中使用 .NET 对象?作为起点这该怎么做)。
That way you can write .Net code for your controls. I haven't done that myself and am not sure how well it applies to your problem, but it looks like an option.
这样您就可以为您的控件编写 .Net 代码。我自己还没有这样做,不确定它对您的问题的适用程度,但它看起来像是一个选择。
I just found a short tutorialfor calling .Net from Excel.
我刚刚找到了一个从 Excel 调用 .Net的简短教程。
回答by Peter Albert
I'm not aware of any solution here. However, JKP has developed a native TreeView in VBA with Userforms onlyto replace the TreeView - which works fine under 64bit.
我不知道这里有任何解决方案。然而,JKP 已经在 VBA 中开发了一个带有 Userforms的本机 TreeView,只是为了替换 TreeView - 它在 64 位下运行良好。
Though labour-intense you could consider adopting it to a ListView control...
尽管劳动强度大,您可以考虑将其用于 ListView 控件...
回答by Johnny Bones
You need to delete and then re-register the control and it will work fine. Use RegSvr32 to re-register the control.
您需要删除然后重新注册该控件,它会正常工作。使用 RegSvr32 重新注册控件。
See this link for more info: http://answers.microsoft.com/en-us/office/forum/office_2010-access/listview-issue-in-access-2010/d0b6f86a-1d9c-4d7f-8566-b80a10bb67c6
有关详细信息,请参阅此链接:http: //answers.microsoft.com/en-us/office/forum/office_2010-access/listview-issue-in-access-2010/d0b6f86a-1d9c-4d7f-8566-b80a10bb67c6