简体   繁体   English

如何访问数组中的元素

[英]How to access element in array

I work in VBA. 我在VBA工作。 I converted Javascript Array to VB Array. 我将Javascript数组转换为VB数组。 To be honest it is not 100% vba array...It looks as in attached picture. 说实话,它不是100%的vba阵列...它的外观如附图所示。

I would like to access directly individual items from this array/list. 我想直接访问此数组/列表中的单个项目。 I tried: 我试过了:

  1. Msgbox ConvertedArray(1,1) doesn't work Msgbox ConvertedArray(1,1)不起作用
  2. Msgbox ConvertedArray(1).Item("1") doesn't work Msgbox ConvertedArray(1).Item("1")不起作用

All what is working is counting the size of this "array" by writing 所有正在做的事情是通过写来计算这个“数组”的大小

 For each Item in ConvertedArray
 ItemNo = ItemNo+1
 Next

Do you have any clue what is wrong with that array? 你有什么线索该数组有什么问题吗?

在此处输入图片说明

its the multidimensional array, you will need to access it through index element and not by item string 其多维数组,您将需要通过索引元素而不是通过项目字符串访问它

ConvertedArray(1)(1)

or 要么

ConvertedArray(1).Item(1)

should work for you 应该为你工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM