Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return value from excel macro
Hi All,
I have application in C# which I call excel MACRO. All works fine. the point is that i want to return value(even simple - 0\1). I saw some samples in vb but it doesn't work in C#. This is what I do: Excel Public Function te() As Long te = 1 End Function C# int k = ( int )oXL.Run( function_name , val0,val1...val28); in this case, i get exeption in C#. thanks for the help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return value from excel macro
The number of parameters have to match between the C# call and the excel macro.
The function can havve more parameters than the calling statement, but not the opposite. You are probabbly getting a stack exception. Your caling functrion has 28 parameters. " wrote: Hi All, I have application in C# which I call excel MACRO. All works fine. the point is that i want to return value(even simple - 0\1). I saw some samples in vb but it doesn't work in C#. This is what I do: Excel Public Function te() As Long te = 1 End Function C# int k = ( int )oXL.Run( function_name , val0,val1...val28); in this case, i get exeption in C#. thanks for the help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return value from excel macro
On Mar 28, 1:13 am, Joel wrote:
The number of parameters have to match between the C# call and the excel macro. The function can havve more parameters than the calling statement, but not the opposite. You are probabbly getting a stack exception. Your caling functrion has 28 parameters. " wrote: Hi All, I have application in C# which I call excel MACRO. All works fine. the point is that i want to return value(even simple - 0\1). I saw some samples in vb but it doesn't work in C#. This is what I do: Excel Public Function te() As Long te = 1 End Function C# int k = ( int )oXL.Run( function_name , val0,val1...val28); in this case, i get exeption in C#. thanks for the help- Hide quoted text - - Show quoted text - It works fine. the problem is with the retval. I send 30 parameters. from val0-val28 = 29 params + function name. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return value from excel macro
Passing parameters and return values arre pushes and pops off of a memory
stack. the compiler uses the number of parameters to determine the number of memory locations that are needed. If you send more parameters than the function uses your return value will get screwed up. You also have tto mnake sure each parameter type is consitant between the calling routine and and the routine. " wrote: On Mar 28, 1:13 am, Joel wrote: The number of parameters have to match between the C# call and the excel macro. The function can havve more parameters than the calling statement, but not the opposite. You are probabbly getting a stack exception. Your caling functrion has 28 parameters. " wrote: Hi All, I have application in C# which I call excel MACRO. All works fine. the point is that i want to return value(even simple - 0\1). I saw some samples in vb but it doesn't work in C#. This is what I do: Excel Public Function te() As Long te = 1 End Function C# int k = ( int )oXL.Run( function_name , val0,val1...val28); in this case, i get exeption in C#. thanks for the help- Hide quoted text - - Show quoted text - It works fine. the problem is with the retval. I send 30 parameters. from val0-val28 = 29 params + function name. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to check data from excel list against access query and return value back to excel | Excel Worksheet Functions | |||
Set up a macro in one row and then return to fill in next row? | Excel Programming | |||
put value into cell after return from macro | Excel Programming | |||
run macro on return | Excel Discussion (Misc queries) | |||
I want to run a macro when i press return | Excel Programming |