RunTime Error 3704 Loading Recordset from Stored Procedure
I am attempting to load a recordset generated by an SQL stored procedure (no parameters) into Excel using VBA. When my code hits the last line, highlighted below, a "RunTime Error 3704: Application-Defined or Object-Defined Error" error occurs.
Any ideas?
Dim RSData2 As ADODB.Recordset
Dim DBConn As New ADODB.Connection
Const stADO = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
"Initial Catalog=PennTel_Core_Demo;" & _
"Data Source=172.17.9.44"
stSQL = "aaa_WPAHS1"
Set RSData2 = New ADODB.Recordset
'On Error GoTo Cleanup
Call RSData2.Open(stSQL, stADO, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly, CommandTypeEnum.adCmdStoredProc)
Call Range("C10").CopyFromRecordset(RSData2)
kedst1

