如何将.net词典转换为VBA字典. [英] how to convert .net dictionary to VBA dictinary.

查看:148
本文介绍了如何将.net词典转换为VBA字典.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



假设我创建了一个字典,如:

字典< string,object> dict = 字典< string,object>();
dict.Add(" "  1");
dict.Add(" "  2");
dict.Add(" "  3");
dict.Add(" "  4"); 


并且我将这条教义传递给了VBA.但是由于它是.NET对象,因此无法正确地传递到VBA.
因此,有没有我可以用来将.NET数据类型解析为VBA数据类型的解析函数.
我在要传递的C#中具有对象的字典和列表类型.
请让我知道.

谢谢与问候
Monil Gangar

解决方案

可能有帮助, ^ ]

将.net词典转换为Excel词典(自定义列表)的确切功能不存在,但是您可以使用 ^ ]将字典复制到数组中,然后使用

备注:


如果您要添加的列表已经存在,则此方法(AddCustomList)不会执行任何操作.


Hi,

Suppose I Have created a dictionary like:

Dictionary<string,object> dict = new Dictionary<string,object>();
dict.Add("First", "1");
dict.Add("Second", "2");
dict.Add("third", "3");
dict.Add("Forth", "4");


and I am passing this dictinary to VBA.but it is not coming properly there because it its .NET object.
So is there any parsing function by which I can parse the .NET data types to VBA data types.
I am having dictionary and List type of objects in C# that I want to pass.
Please let me know.

Thanks and Regards
Monil Gangar

might help, .NET and VBA interoperability[^]


The exact function to convert .net dictionary into Excel dictionary (custom list) doesn''t exists, but you can use Dictionary.CopyTo[^] to copy dictionary into an array and then use AddCustomList[^] function to add custom list.

Remarks:


If the list you''re trying to add already exists, this method (AddCustomList) does nothing.


这篇关于如何将.net词典转换为VBA字典.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆