Controls the instancing characteristics of a class.
Attribute VB_Exposed = False
Makes the class Private
. It cannot be accessed outside of the current project.
Attribute VB_Exposed = True
Exposes the class Public
ly, outside of the project. However, since VB_Createable
is ignored in VBA, instances of the class can not be created directly. This is equivalent to a the following VB.Net class.
Public Class Foo
Friend Sub New()
End Sub
End Class
In order to get an instance from outside the project, you must expose a factory to create instances. One way of doing this is with a regular Public
module.
Public Function CreateFoo() As Foo
CreateFoo = New Foo
End Function
Since public modules are accessible from other projects, this allows us to create new instances of our Public - Not Createable
classes.