Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.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
Vba 组合框错误:无法设置列属性。类型不匹配_Vba_Excel_Combobox - Fatal编程技术网

Vba 组合框错误:无法设置列属性。类型不匹配

Vba 组合框错误:无法设置列属性。类型不匹配,vba,excel,combobox,Vba,Excel,Combobox,我正在使用Excel VBA Userforms并尝试填充组合框,但收到无法设置Column属性的错误。类型不匹配 组合框的ColumnCount属性设置为3 我正在使用下面的代码填充组合框: 调试器将带有UF_主线的标记为有问题的行,但这只发生在第三个循环开始时,它应该循环1000多次 在调试时高亮显示该行时,它会显示 在UserForm/控件中没有任何其他更改属性的操作。导致错误的原因是什么?该控件后面是否有任何事件代码?@Rory否没有事件代码。这种方法我用了好几次,都没有问题。我已经尝试

我正在使用Excel VBA Userforms并尝试填充组合框,但收到无法设置Column属性的错误。类型不匹配

组合框的ColumnCount属性设置为3

我正在使用下面的代码填充组合框:

调试器将带有UF_主线的标记为有问题的行,但这只发生在第三个循环开始时,它应该循环1000多次

在调试时高亮显示该行时,它会显示


在UserForm/控件中没有任何其他更改属性的操作。导致错误的原因是什么?

该控件后面是否有任何事件代码?@Rory否没有事件代码。这种方法我用了好几次,都没有问题。我已经尝试使用新创建的组合框将代码添加到新的用户表单中,并且发生了相同的错误,这对我来说意味着它特定于这段代码。该错误行的数组中有哪些数据?@Rory数组varList是从函数fGetCms填充的,该函数是从记录集填充的变量数组。好的,但是数组中有哪些数据用于出错的行?有空值或错误吗?
Dim i As Long
Dim varList As Variant

With UF_Main
    'Get CM list
    With .cbNAEmployee
        .Clear
        varList = fGetCMs
        If Not isArrayEmpty(varList) Then
            For i = LBound(varList, 2) To UBound(varList, 2)
                .AddItem varList(0, i)
                .Column(1, i) = varList(1, i)
                .Column(2, i) = varList(2, i)
            Next i
        End If
    End With
End With