Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: How do I incorporate basic modules in DLL files?


Message #1 by peterfrb2@y... on Mon, 18 Feb 2002 07:40:50
I'll try.  If you look at the VBA dll in the object library, on the left 
side marked "classes", several icons indicating regular modules (*.bas) 
show up: Constants, Conversions, DateTime, etc.  

In my code, I define a type with the following elements:

Type KeyControl
    strKey As String
    MyControl As VB.Control
    MyButton As VB.CommandButton
End Type

Because of the presence of Control and CommandButton, I must place this 
type in a Basic module.  If I attempt to put it in a class, I get the 
following error message: "Private object modules can not be used in public 
object modules as parameters or return types for public procedures, as 
public data members, or as fields of public user defined types."  

When I wish to include the KeyControl type in my class module, my 
workaround solution is to include a basic module with the type definition 
in it.  I must also include the same basic file in any executable file 
that also references KeyControl.  The workaround is not heinously odious, 
but it is less elegant than it would be if I could create a reference to 
KeyControl in my DLL.  And if anyone else were to use my program, said 
person would have to be made aware of this little extra piece of 
bookkeeping.  

My observation of the VBA DLL in my object browser led me to believe that 
such a reference is possible.

--Peter Ferber

  Return to Index