I have come up with a "near enough" solution.
I created a private variant function containing the arrays I want to add. I then set the function as an array of all these arrays (not what I was hoping for, because it means that if I want to add a new array, I need to not only hard code the new array name as a new Dim, I need to add another name to the Nested array)
In the create controls code, I loop through each array in the Nested array. I set a temporary variant as the current array in the nest and then run a secondary loop through the temp array to add the controls. See code at bottom of this post.
In answer to my original questions:- Yes (nested array as variant function)
- Apparently not (or if there is, nobody is saying! )
- Yes - see code in this post
- Collections not needed after all
For bytArrNo = LBound(varPopupMacroNames) To UBound(varPopupMacroNames)
varTemp = varPopupMacroNames(bytArrNo)
With .Add(Type:=msoControlPopup, temporary:=True)
.Caption = varTemp(1)
.BeginGroup = True
.Tag = C_TAG
For bytCtrl = LBound(varTemp) + 1 To UBound(varTemp)
With .Controls.Add(Type:=msoControlButton, temporary:=True)
.OnAction = "'" & ThisWorkbook.Name & "'!" & varTemp(bytCtrl)
.Caption = varTemp(bytCtrl)
.Tag = C_TAG
End With
Next bytCtrl
End With
Next bytArrNo
Bookmarks