0

我正在尝试编写一个返回多维数组的函数。问题是数组的大小没有定义。

我的数组在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

将不起作用

4

0 回答 0