View Single Post
  #2   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi Bill,

Try using Application.Run.

Something like:

X = Application.Run("MyAddIn.xla!.MyFunction",Y)


---
Regards,
Norman



"Bill Martin -- (Remove NOSPAM from address)"
wrote in message ...
I have a library XLA file where I keep custom functions I've written and
use in multiple spreadsheets. The XLA file resides in my XLStart
subdirectory and all works as I would expect it to. I can call the
functions from any spreadsheet cell.

My current problem arises in that I'd like to call one of the functions
from within a VBA macro. Somehow I'm unable to figure that out. If I try
to call it normally:

X = MyFunction(Y)

I get a compile error "Sub or Function not defined". So then I tried:

X = Application.WorksheetFunction.MyFunction(Y)

and get an error "Object doesn't support this property or method".
Various other attempts to point VBA to find the custom function all fail.

What's the key? Thanks.

Bill