当我在 excel 2010 中运行以下 VBA 代码时,它可以工作,但在 excel 2013 上运行时显示错误消息。它显示编译错误:类型不匹配并突出显示 rsLCC.RecordCount
Public Sub LoadRegionCombo()
Dim sLCC_SQL As String
Dim rsLCC As New ADODB.Recordset
Set rsLCC = New ADODB.Recordset
On Error GoTo Err_LoadRegionCombo
Call SetDataPath
Call OpenConnection
sQrySub1 = "CONTRACTORS"
QCArr2(0) = "COMBOS"
QCArr2(1) = "ComboSQL"
QCArr2(2) = "" ' sFilter1
QCArr2(3) = "" ' sFilter2
QCArr2(4) = "ASC"
QCArr2(5) = sQrySub1
QCArr2(6) = "" 'sQrySub2
sLCC_SQL = QryCall2(QCArr2())
rsLCC.Open sLCC_SQL, ExelCon, adOpenKeyset, adLockReadOnly
ipCount = rsLCC.RecordCount