Link to home
Start Free TrialLog in
Avatar of tru-numbers
tru-numbersFlag for United States of America

asked on

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
Avatar of Norie
Norie

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.
Avatar of tru-numbers

ASKER

Yes that is a possibility, but the user database is in SQL Server 2005.  The DB has 1000 users worldwide.
Which is a possibility?

The pass through query in Access or pulling directly from SQL Server using VBA in Excel?
I must pull diectly from sql server!
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial