share class modules

flyerStarter

New Member
Joined
Mar 2, 2004
Messages
1
Hi to all.

I have 2 excel files which contain similar functions and class modules.
So I created a third file which contains these similar objects and next added a reference in the 2 files to this third file. No problem for "normal modules" but for classes modules".

I tried to find some informations but found nothing, except creating a dll file.
Isn't it possible to add class modules in my third file ?

Thkx for your answer.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Yes, it is.

Change the Instancing property to 'PublicNotCreatable'.

Now, in the third book, you need to create some functions to create the class modules, and return a reference for the other books. It's basically like using late binding...

Something like

Code:
Function NewClass1() As Class1
    Set NewClass1 = New Class1
End Function

and in the other books you use stuff like

Code:
Sub Test()
  Dim myClass As Object
  Set myClass = NewClass1()
  'Do stuff with myClass
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,953
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top