Thread: Excel Library
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Henning Eiben Henning Eiben is offline
external usenet poster
 
Posts: 9
Default Excel Library

Am Tue, 5 Oct 2004 12:45:59 +0100 schrieb Bob Phillips
:

You can still use the add-in, but you can create an instance of the
class in
the other workbook.

What you could do is to create an instance in the add-in, and use that.
Something like
- create the class in the project and set the instancing to Public Not
Creatable
- in a standard code module in the add-in, create a function like

Public Function CreateObj() As Class1
Set CreateObj = New Class1
End Function

Then, in the other workbook project, use something like

Dim Obj As Object
Set Obj = ProjName.CreateObj()

Here, it the add-in that is actually creating the instance of the class,
the
other workbook is only getting a reference to that object.


OK, I created a public ObjectFactory in my XLA ... this seems to work,
although I don't have early binding in my XLS anymore :( well ... but I
have some problems with user-defined types. I have a type

Public Type Periode
Jahr As Integer
Monat As Integer
End Type

wich I want to reference from my XLS as well as my XLA, and I want to pass
this type as a parameter to some classes (in the XLA). But when I try to
compile my code I get an error-message something like "public defined
types cannot be casted into variant" ... well, I get the message in german
actually, so I don't know how it would look like in english.

Any suggestions on what this problem might be?