Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default UDF Function Arguments List

We've created an Excel addin (.xla) that has some user defined
functions. One of the functions returns a single result from a store
procedure on SQL Server. The user wants to be able to right click on
the cell that contains the function, and return a result set from a
query using the functions same argument list. In other words, the
function returns a total, and he may want to see the underlying detail
records. I got this to work fairly easily. On the Worksheets
Before_Right_Click event, I check to see the active cell contains the
required udf. If it does, then I parse the cell contents (my udf
formula) to retrieve the arguments that I then pass to a query.
However, a difficulty arises when, technically, there can be another
Excel Formula embedded within my function call.

ie: =MyFunc( 100, 100, #1/3/2003#, #1/30/2003# ) - This will work
fine
as I parse the argument list.

if instead they do this :
=MyFunc( 100, 200, Now()-60, Now()-30 ) - This is a pain in that
I have to evaluate the 3rd and 4th arguments before I pass them on to
the query. Excel already does this in their function calls. Does
anyone have any ideas how I might easily accomplish this. The 3rd and
4th arguments can technically be any valid date function call.

Thanks in advance,
-WATjr.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default UDF Function Arguments List

Hi Walter,

try using Application.evaluate or worksheet.evaluate

hth
Charles Williams
www.DecisionModels.com

"WATjr" wrote in message
om...
We've created an Excel addin (.xla) that has some user defined
functions. One of the functions returns a single result from a store
procedure on SQL Server. The user wants to be able to right click on
the cell that contains the function, and return a result set from a
query using the functions same argument list. In other words, the
function returns a total, and he may want to see the underlying detail
records. I got this to work fairly easily. On the Worksheets
Before_Right_Click event, I check to see the active cell contains the
required udf. If it does, then I parse the cell contents (my udf
formula) to retrieve the arguments that I then pass to a query.
However, a difficulty arises when, technically, there can be another
Excel Formula embedded within my function call.

ie: =MyFunc( 100, 100, #1/3/2003#, #1/30/2003# ) - This will work
fine
as I parse the argument list.

if instead they do this :
=MyFunc( 100, 200, Now()-60, Now()-30 ) - This is a pain in that
I have to evaluate the 3rd and 4th arguments before I pass them on to
the query. Excel already does this in their function calls. Does
anyone have any ideas how I might easily accomplish this. The 3rd and
4th arguments can technically be any valid date function call.

Thanks in advance,
-WATjr.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum function changes arguments Dianeg Excel Worksheet Functions 1 January 13th 10 02:25 PM
FUNCTION arguments mbr Excel Worksheet Functions 6 August 6th 09 06:41 AM
MIN Function with arguments Freshman Excel Worksheet Functions 9 September 11th 08 02:50 AM
IF function with too many arguments ahutyra Excel Worksheet Functions 3 August 8th 08 02:01 AM
Function Arguments Jessica Excel Worksheet Functions 4 September 18th 06 03:05 AM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"