How to change value of an item of a collection

后端 未结 2 1838
猫巷女王i
猫巷女王i 2020-12-06 17:32

With this code (in excel-vba) I add to a collection a number of items depending on an array.
I use the value of the array as key and the string \"NULL\" as value for eac

2条回答
  •  醉酒成梦
    2020-12-06 17:59

    You can also write a (public) function to make updates to a collection.

    public function updateCollectionWithStringValue(coll as Collection, key as string, value as string) as collection
        coll.remove key
        coll.add value, key
        set updateCollectionWithStringValue = coll
    end function
    

    You can invoke this function by:

    set coll = updateCollectionWithStringValue(coll, "String1","myString")
    

    Then you have a one liner to invoke.

提交回复
热议问题