VBA - How to add a collection to a collection of collections

后端 未结 3 2079
礼貌的吻别
礼貌的吻别 2021-02-20 06:20

I am trying to create code to represent a form document using VBA in Word 2007. I have created classes to represent Section, QuestionSet and Question.

So I have 15 Secti

3条回答
  •  不要未来只要你来
    2021-02-20 07:08

    Try this simple example:

    Private Sub CommandButton1_Click()
    
        Dim masterCollection As New collection
        masterCollection.Add "first key", createDetailCollection()
        masterCollection.Add "second key", createDetailCollection()
        masterCollection.Add "third key", createDetailCollection()
    
    End Sub
    

    The follow function return a initializated collection

    Function createDetailCollection()
        Dim collection As New collection
        createCollection = collezioneBuy
    End Function
    

提交回复
热议问题