想要避免创建类。
仅公共对象模块中定义的用户定义类型可以与变体强制转换或强制转换,或传递给后期绑定函数
只有解决方案,我看到了:
创建一个要用数组填充的数组。 创建要填充第一个数组的数组。 用指向第二个数组的指针填充第一个数组(一旦给定指向标头结构的指针,我就具有访问数组元素的功能)
Private Type GameBoardCell
Column As Long
Row As Long
End Type
Sub testgameboard()
Dim temparry() As GameBoardCell
temparry = GameboardCellsInitalize
End Sub
Private Function GameboardCellsInitalize() As GameBoardCell()
Dim TempArrayRows() As Variant
Dim TempArrayColumns() As GameBoardCell
Dim GameBoardCell As GameBoardCell
Dim Index As Long
Dim IndexTwo As Long
ReDim TempArrayRows(0 To 27)
For Index = 0 To UBound(TempArrayRows)
ReDim TempArrayColumns(0 To 51)
For IndexTwo = 0 To UBound(TempArrayColumns)
GameBoardCell.Column = IndexTwo + ColumnOffset
GameBoardCell.Row = Index + RowOffset
TempArrayRows(Index) = TempArrayColumns
Next IndexTwo
Next Index
GameboardCellsInitalize = TempArrayRows
End Function