对象closuresVBA时不允许操作

当它到达下面的代码的第四行时,我的代码与上述错误失败。 我之前在我的程序中使用了相同的格式,它工作得很好。 如果需要更多代码来解决错误,我很乐意发布。 谢谢。

With rsTIP19 .ActiveConnection = cnTIP .Open "exec usp_Service_Data_Query_QA" ThisWorkbook.Sheets("Service_Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).CopyFromRecordset rsTIP19 .Close End With 

exec的目的是什么? 您应该testing.BOF.EOF

 With rsTIP19 .ActiveConnection = cnTIP .Open "usp_Service_Data_Query_QA" If Not .BOF or .EOF then ThisWorkbook.Sheets("Service_Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).CopyFromRecordset rsTIP19 End If .Close End With