Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Importing Data from a Stored Procedure (SQL SErver)

Hi there,

I am trying to import data from a Stored procedure which has a Select
Statement in it into Excel.
I could also exec the select Statement out of Excel (VBA), that would be ok
for me also.

I am struggling in setting up the Connection and the Recordset Objects and
then call the CopyfromRecordset method.

For example:
I have in my code:
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection

and I get the following Error while running the Macro: Compile Error:
User-Defined type not defined

I have to admit that I am not that good in ADODB Connection building and
Recordset operations...

I would appreciate your help big time.

Thanks,
Martin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Importing Data from a Stored Procedure (SQL SErver)

Martin,

the error you are getting suggests that you haven't set a reference to ado.
You want to get the latest MDAC version from MS
http://www.microsoft.com/downloads/d...displaylang=en

there was also an update put out by MS on the 13th patching a security flaw.
I can't find the link, but try windows update..

In your VBA project, make sure you have a reference set to ms activex data
objects 2.7 library. On my system the file resides in c:\program
files\common files\ado\msado27.tlb.

If you are looking for general information on using ado with excel, the best
I have found so far is in Excel 2002 VBA by Stephen Bullen et al.

Robin Hammond
www.enhanceddatasystems.com


"Martin Eckart" wrote in message
...
Hi there,

I am trying to import data from a Stored procedure which has a Select
Statement in it into Excel.
I could also exec the select Statement out of Excel (VBA), that would be

ok
for me also.

I am struggling in setting up the Connection and the Recordset Objects and
then call the CopyfromRecordset method.

For example:
I have in my code:
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection

and I get the following Error while running the Macro: Compile Error:
User-Defined type not defined

I have to admit that I am not that good in ADODB Connection building and
Recordset operations...

I would appreciate your help big time.

Thanks,
Martin




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data return from SQL Stored procedure... Jonathon Shull Excel Discussion (Misc queries) 0 July 29th 08 04:25 PM
Extract data from Stored procedure anu_manu Excel Discussion (Misc queries) 0 February 15th 06 02:49 PM
How do I access data stored in a SQL server for vlookup function? M.Heer Excel Worksheet Functions 8 May 12th 05 09:51 PM
How can I grab data from a SQL Server stored procedure Sam Excel Programming 3 December 4th 03 03:38 PM
Execute stored procedure using DAO sapta wijaya Excel Programming 0 September 29th 03 04:24 AM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"