Go to "Project" -> "References", tick the box next to the DLL, and press OK.
Then add code like this:
Code:
Dim MyObject as Project1.Class1
Set MyObject = New Project1.Class1
'code to work with MyObject
Set MyObject = Nothing
You need to replace Project1 with whatever code name you gave your DLL, and Class1 with a class that it exposes (they will be listed when you type the . )
The error means that the library name you chose for the DLL isn't unique - you have another item in your project (or even the project itself) which has the same name (which you set under "Project" -> "Properties"). Give the DLL a name which is unique, and try again.
As to the "'code to work with MyObject" part, that is entirely dependent on the code in your DLL - but would be the same as if you were using the class directly in the same project.
I have design the form1,form2 and also name the class1 and save it as project2
But How I can access the form in the class? I can see the class1 list. I also add it as reference.But When typing MyObject , the from1 and form2 not listed. How to list it? hopes learning from the sample attach file from you
Dim MyObject As Project2.Class1
Set Myobject = New Project2.Class1
Actually I would like to create the dll from your sample.
Then I open another project, I add your dll as reference and would like to showed the form when I click the button on the form I design. Something like that.