View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Bryan Dickerson Bryan Dickerson is offline
external usenet poster
 
Posts: 42
Default Newbie at mixing ADO and Excel

Oh, BTW, I thought I would include that I am able to use this query as the
basis for a spreadsheet ("Data, Import External Data"). So I can update the
parameters of the EXEC SPReport call and run it that way. This VBA stuff is
mostly for "User Friendliness", so I am getting results returned, but for
some reason I'm just having problems in the VBA getting the Recordset to
dump into the spreadsheet
(Worksheets.Item("Sheet1").Range("A1").CopyFromRec ordset oRS). Does that
jog anyone's memory? Does the fact that I'm only specifying a range of "A1"
have anything to do with it?

"Bryan Dickerson" wrote in message
...
I tried exactly what you suggested and again, the query ran (I tried

running
in MS Query Analyzer what the Excel VBA was trying to run and it ran
correctly and returned rows), but when I put a debugging break in the code
at the next statement and used the immediate window, I tried oRS.MoveFirst
and got the error "Run-Time error 3704: Operation is not allowed when the
object is closed." That seems awfully strange--I shouldn't have to 'open'
the recordset object after it's created, should I? BTW, I get basically

the
same error regardless of what command I attempt on the recordset object or
what property I attempt to view.

"onedaywhen" wrote in message
oups.com...
Bryan Dickerson wrote:
the Execute method works (or at least
doesn't return an error). But I put a breakpoint at the next

statement:
Worsheet("Sheet1").Range("A1").CopyFromRecordset oRS" and did some

playing
with the oRS object. When I put "? oRS.Fields.Count" it gave me the

error
message: "Run-time error '3704' Operation is not allowed when the

object is
closed."


Are you sure you are associating the recordset with the returned rowset
(I'm assuming you stored proc *does* return data)? I rarely use a
Command object myself so I'd do something like:
Set oRS = oConnection.Execute("EXEC blah...")

Jamie.

--