我有以下Variant:
Dim comboitems() As Variant
我在所有代码中使用的数组包含ComboBox
控件的值。
在代码的某个点上,我需要清除/清空/ null comboitems()
。我能怎么做?我尝试了以下所有选项但没有成功。
comboitems = ""
comboitems = Null
comboitems = Nothing
Set comboitems = ""
Set comboitems = Null
Set comboitems = Nothing
comboitems() = ""
comboitems() = Null
comboitems() = Nothing
Set comboitems() = ""
Set comboitems() = Null
Set comboitems() = Nothing
我得到的错误是这样的:
对于变体数组,您可以使用erase命令清除它们。
Erase comboitems
这是一个方便的参考指南,用于处理vba中的数组: