ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calling a method on an object created in a different addin (https://www.excelbanter.com/excel-programming/381066-calling-method-object-created-different-addin.html)

scotty[_2_]

calling a method on an object created in a different addin
 
I wonder if this is possible. I am a newbie by the way.

Addin1 has a function called obj that returns an object that is
created with methods etc.

Public Function obj() As MySpecialType ' type from tld com interface
On Error Resume Next
' some tuff here to create object
End Function

In another separate addin (addin2) i need to be able to get a handle
to the object and call methods on this object

Set localobj = Application.run obj
localobj.dostuff...etc

I can't get this to work. I must be mis-understanding something.

PS, I am trying not to hard code in references if possible. the idea is
the code is dynamic, finds if addins are loaded, call methods on those
to merge a certain dataset.


scotty[_2_]

calling a method on an object created in a different addin
 

got it working...just needed to appreciate run takes a string. doh.

Dim result
Dim obj
Set obj = Application.Run("somemeth")
result = obj.method1 etc...



All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com