• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

write SQL Server 2 Excel

I know there must be a way to write to  cells within excel from sql Server.  This is possible to do in access.

I need VBA code (Function) that will write a stored procedure results to a user defined location on a excel workbook.

Lets say the SP returns 6 records (each records contains five fields).  I want to dump the results to cell "A1" or any other location in the workbook.

                  Cell A1   Cell B1    Cell C1       Cell D1    Cell E1
  record 1  FName   LName     Address     city          State
  record 2  FName   LName     Address     city          State
.
.
.
  record 6  FName   LName     Address     city          State
0
tru-numbers
Asked:
tru-numbers
  • 3
  • 2
1 Solution
 
NorieCommented:
So you need to do it in Access?

You could do this using VBA and ADO in Excel.

If you do need it in Access you could set up a pass through query to return the results, then export the results to Excel.
0
 
tru-numbersAuthor Commented:
Yes that is a possibility, but the user database is in SQL Server 2005.  The DB has 1000 users worldwide.
0
 
NorieCommented:
Which is a possibility?

The pass through query in Access or pulling directly from SQL Server using VBA in Excel?
0
 
tru-numbersAuthor Commented:
I must pull diectly from sql server!
0
 
NorieCommented:
You can use VBA with ADO for that.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now