View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
FrankJO FrankJO is offline
external usenet poster
 
Posts: 10
Default VB 2005 User Defined Function (via Automation Add-in) Generate

Thanks, Peter. The "XL = Returns.Parent" bit, which was also suggested by Jim
above, did the trick.

"Peter T" wrote:

Please see Chip Pearson's post.


In particular this bit
"
In a Shared Add-In written in NET, Application is an Object parameter
passed in at startup that references the host application.
"

Having not paid attention first time I've since had a better look at your
VBA and NET

In a UDF you cannot change the interface as you are attempting to do in a
big way just to get the Application object. Not sure but to get you started
you might be able to do this instead -

XL = Returns.Parent.Application

where "Returns" is the excel.range object passed to the UDF

Even if that works better to go with Chip's pointer and maintain a global
ref to the application that was passed at startup (looks very simlar to a
how it would be done in a VB6 Com addin)

Regards,
Peter T