开发者

Determining actual args an Excel UDF was called with

开发者 https://www.devze.com 2022-12-25 05:29 出处:网络
I\'m adding a user defined function to Excel with varargs-based signature in C++: LPXLOPER MyFunction(...);

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?


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

Use excelApp->get_Caller();

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号