Calling a Class from an external AddIn

W

Woo Mun Foong

I have written some classes using Access XP ,successfully compiled as a MDE.
I would like to take this MDE and share it with my team members in the form
of AddIn. (Reference)
My intention is for my team members to add a reference of MDE to their MDB
and they can start using my classes inside their MDB.
However when they try to do it, the compiler gives error.

For example : (in my team member MDB)
Dim cFileObj as clsFileInfo
(where clsFileInfo is a class created by me inside another MDB)

The compiler complains :- User-defined type not defined

Please help.
 
A

Albert D. Kallal

You can simply make a public function in the mde that returns an instance of
the object. That will work.

You can also change the class object to be exposed. You can do this. It is
not officially supported. This works with a mdb, and you an then convert it
to a mde.

Check out:

http://www.mvps.org/access/modules/mdl0034.htm

You can use the following to export the class module:

saveastext acmodule,"yourclassname","c:\classname.txt"

Now, fire up your text editor to edit the above. change:

Attribute VB_Exposed = True

and save the file


Then, delete your class module, and then:

loadfromtext acmodule,"yourclassname","c:\classname.txt"

Test this on a copy....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top