Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Best way to call stored procedure, have results return in cell ran
I am totally new to Excel programming, so please be patient with me while I
try and explain what it is that I need. I would like to call a stored procedure from Excel and have the results placed in a specific range of cells, for example starting at D7 to K7 for however many rows are returned. So my question is this: What is the best way to call the Stored Procedure and how do i place the results in a specific range of cells? Should I place a button on the page and call the proc on the click event? Any advise is greatly appreciated. -- Thanks, Scott |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Best way to call stored procedure, have results return in cell ran
where is the procedure? in an excel module? if so, you can use Call xxx
xxxbeing the name of the sub routine. Otherwise, more information is needed to be able to assist. "SQLScott" wrote: I am totally new to Excel programming, so please be patient with me while I try and explain what it is that I need. I would like to call a stored procedure from Excel and have the results placed in a specific range of cells, for example starting at D7 to K7 for however many rows are returned. So my question is this: What is the best way to call the Stored Procedure and how do i place the results in a specific range of cells? Should I place a button on the page and call the proc on the click event? Any advise is greatly appreciated. -- Thanks, Scott |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Best way to call stored procedure, have results return in cell ran
Assume your procedure exists and is error free if run. The first line of
code is the title line. for example: Sub myProcedure() 'Lot's of events End Sub The above procedure's name is "myProcedure" When you record a procedure, there is usually a dialog box that appears and asks if you want to assign a shortcut key. At that time you can pick any letter of the alphabet as a shortcut key. To use that key to call the procedure, you mus press the Ctl key and hold it while pressing your shortcut key. To assign a shortcut key to an existing procedure that was not recorded, click ToolsMacroMacros and left click the name of your procedure to make it appear in the small window of the dialog box. Then click Options at the bottom of the dialog box and when the Macro Options dialog box appears, type the keyboard letter in the small box and click OK, then Cancel or the big X on the Macro dialog box. If you want to use a button, there are two sources for the button. One is from the forms toolbar. If you use that button, you put the button on the sheet, then right click it and select "Assign Macro" from the drop down menu and basically follow the prcedure above for the Macro Options box. If you use the button from the Control Toolbox, then when you put the b utton on the sheet, you must be in design mode to right click the button and from the drop down menu select "View Code" When the code window opens, put this paste this code into the code window. Private Sub CommandButton1_Click() myProcedure End Sub This assumes that myProcedure is in the standard module1 code module. If you want to run the code for editorial purposes, you can open the VB editor and click the run button or you can click ToolsMacroMacros then click on the procedure you want and click Run. That's pretty much it! "SQLScott" wrote: I am totally new to Excel programming, so please be patient with me while I try and explain what it is that I need. I would like to call a stored procedure from Excel and have the results placed in a specific range of cells, for example starting at D7 to K7 for however many rows are returned. So my question is this: What is the best way to call the Stored Procedure and how do i place the results in a specific range of cells? Should I place a button on the page and call the proc on the click event? Any advise is greatly appreciated. -- Thanks, Scott |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Best way to call stored procedure, have results return in cell
I guess I should have been more specific.
I want to call a SQL Server stored procedure from within Excel and populate a specific range of cells with the results returned from the SQL Server stored procedure. I hope this clarifies things... -- Thanks, Scott "JLGWhiz" wrote: Assume your procedure exists and is error free if run. The first line of code is the title line. for example: Sub myProcedure() 'Lot's of events End Sub The above procedure's name is "myProcedure" When you record a procedure, there is usually a dialog box that appears and asks if you want to assign a shortcut key. At that time you can pick any letter of the alphabet as a shortcut key. To use that key to call the procedure, you mus press the Ctl key and hold it while pressing your shortcut key. To assign a shortcut key to an existing procedure that was not recorded, click ToolsMacroMacros and left click the name of your procedure to make it appear in the small window of the dialog box. Then click Options at the bottom of the dialog box and when the Macro Options dialog box appears, type the keyboard letter in the small box and click OK, then Cancel or the big X on the Macro dialog box. If you want to use a button, there are two sources for the button. One is from the forms toolbar. If you use that button, you put the button on the sheet, then right click it and select "Assign Macro" from the drop down menu and basically follow the prcedure above for the Macro Options box. If you use the button from the Control Toolbox, then when you put the b utton on the sheet, you must be in design mode to right click the button and from the drop down menu select "View Code" When the code window opens, put this paste this code into the code window. Private Sub CommandButton1_Click() myProcedure End Sub This assumes that myProcedure is in the standard module1 code module. If you want to run the code for editorial purposes, you can open the VB editor and click the run button or you can click ToolsMacroMacros then click on the procedure you want and click Run. That's pretty much it! "SQLScott" wrote: I am totally new to Excel programming, so please be patient with me while I try and explain what it is that I need. I would like to call a stored procedure from Excel and have the results placed in a specific range of cells, for example starting at D7 to K7 for however many rows are returned. So my question is this: What is the best way to call the Stored Procedure and how do i place the results in a specific range of cells? Should I place a button on the page and call the proc on the click event? Any advise is greatly appreciated. -- Thanks, Scott |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Call a procedure whose name is stored in a variable | Excel Programming | |||
HELP No return data from my stored procedure | Excel Programming | |||
sql stored procedure results in a recordset questions | Excel Programming | |||
How to call a stored procedure in a macro | Excel Programming | |||
Stored Procedure call and passing parameters | Excel Programming |