I ran into an Excel bug recently. To run a stored procedure in Excel one option is to:
- Connect to GP via ODBC and MS Query
- Connect to a table and return data
- Send the data to Excel
- Change the SQL, add the stored proc, with Execute StoredProc ?,?
- Excel will pick up the parameters. Point them to cells.
The problem is that after you save and reopen the file, it can crash Excel. This doesn’t happen all the time but I had it happen consistently in Excel 2010.
The answer is to add it differently:
- Connect to GP via ODBC and MS Query
- Connect to a table and return data
- Change the SQL in MS Query. use {Call StoredProc (?,?)}
- Key in placeholder amounts for the parameters
- Send the data to Excel
- Point the parameters to cells.
There is a lot more detail here: http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/d86fbdfa-82e2-4da7-92df-ae5f0f60090b