tags:

views:

30

answers:

1

I'm adding a user defined function to Excel with varargs-based signature in C++:

LPXLOPER MyFunction(...);

When Excel calls MyFunction, it passes it 30 arguments regardless of how many the user entered in the sheet. The extraneous ones are blank strings.

MyFunction, however, is designed to accept empty string arguments. As a result, I cannot tell valid empty strings apart from the extraneous ones sent by Excel.

A solution could be to obtain the contents of the actual cell where the user entered the function. However, I can't find a way of doing that from within the implementation of my function.

Could someone please suggest a way out?

A: 

I've found a simple way to get hold of the caller cell.

Use excelApp->get_Caller();

Frederick