Excel VBA:“;“比较模式”;空字典中的错误
运行此代码时:Excel VBA:“;“比较模式”;空字典中的错误,excel,vba,Excel,Vba,运行此代码时: Dim dic As Object . . . If dic Is Nothing Then Set dic = CreateObject("scripting.dictionary") dic.comparemode = 1 Else dic.RemoveAll
Dim dic As Object
.
.
.
If dic Is Nothing Then
Set dic = CreateObject("scripting.dictionary")
dic.comparemode = 1
Else
dic.RemoveAll
End If
在comparemode
行,我偶尔会得到
错误5:过程调用或参数无效
据我所知,如果字典中有数据,我会得到错误,但正如你所看到的,直到前一行它才存在。发生这种情况时,你能提供更多的具体细节吗?i、 我们如何重现这个错误?如果它只是“偶尔”发生,那么你的代码中的其他东西(你没有在这里发布的代码)会导致这个问题,因为你发布的代码对我来说非常好。