View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
peter peter is offline
external usenet poster
 
Posts: 23
Default Can I have an array of arrays and access an element simply?

I have
Private aAllCMDRows(1 To MAX_CMD_ROWS) As clsCMDdefn6A
Private aAllMACRows(1 To MAX_WS_ROWS) As clsMACdefn6A
Private aAllWSRows (1 To MAX_OP_ROWS) As clsWSdefn6A
(and another two)
Can I put these in another array:
Private aAllArrays(1 To 5)
using
Const ID_CMD = 1
Const ID_MAC = 2
Const ID_WS = 3

aAllArrays(ID_CMD) = aAllCMDRows '
aAllArrays(ID_MAC) = aAllMACRows
aAllArrays(ID_WS) = aAllWSRows

I want to access them as follows:
Dim oCMD As clsCMDdefn6A
addToArray ID_CMD, oCMD

Sub addToArray( iID As Integer, _
vItem As Variant )
Dim vArray As Variant ' ref to array?
Set vArray = aAllArrays(iID) ' type mismatch
vArray(1) = vItem
End Sub

But got the runtime problem in line 2.

Thanks for your help,
Peter.

(It's for an Excel macro under XP)





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!