我正在尝试编写一个返回多维数组的函数。问题是没有定义数组的大小。
我的数组在 my_list()
下面的函数中初始化Dim my_list() As String
Public Sub Load_My_List()
Dim last_column As Integer
last_column = some_helper.Get_Last_Column(somw_worksheet)
'my array is resized in this point
ReDim my_list(1 To last_column - 1, 1)
Dim i As Integer
i = 1
For index= 2 To ultima_colonna
my_list(i, 0) = some_worksheet.Cells(2, index).value
my_list(i, 1) = index
i = i + 1
Next index
End Sub
那么,我如何编写一个返回 my_list 的函数?类似下面的函数会产生错误输入类型错误
Public function Get_My_List as String()
Get_My_List = my_list
End Function
如何正确调用此功能?我觉得像
这样的东西Dim test() as String
test = Get_My_List
将无效