Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA:“;“比较模式”;空字典中的错误_Excel_Vba - Fatal编程技术网

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、 我们如何重现这个错误?如果它只是“偶尔”发生,那么你的代码中的其他东西(你没有在这里发布的代码)会导致这个问题,因为你发布的代码对我来说非常好。