Can an Excel VBA UDF called from the worksheet ever be passed an instance of any Excel VBA object mo

Posted by jtolle on Stack Overflow See other posts from Stack Overflow or by jtolle
Published on 2010-04-07T22:11:26Z Indexed on 2010/04/07 22:13 UTC
Read the original article Hit count: 289

Filed under:
|
|

I'm 99% sure that the answer is "no", but I'm wondering if someone who is 100% sure can say so.

Consider a VBA UDF:

Public Function f(x)

End Function

When you call this from the worksheet, 'x' will be a number, string, boolean, error, array, or object of type 'Range'. Can it ever be, say, an instance of 'Chart', 'ListObject', or any other Excel-VBA object model class?

(The question arose from me moving to Excel 2007 and playing with Tables, and wondering if I could write UDFs that accept them as parameters instead of Ranges. The answer to that seems to be no, but then I realized I didn't know for sure in general.)

© Stack Overflow or respective owner

Related posts about excel

Related posts about vba