Instancing Property (VB only)

Description

Only available when a class is part of an ActiveX project. The Instancing property defines how instances of the class are created, and whether or not instances of the class can be created outside of the project. This property is available only at design time.

Values

GlobalMultiUse

The class becomes global to the project in which it's defined; references aren't necessary. For example, most VB language objects are global; as soon as you load the environment, they can be used. Not available within ActiveX Control projects.

MultiUse

The default property value for classes within ActiveX DLL or EXE projects. The class has scope (i.e., it's visible) outside the project in which it's defined, and it can be instantiated using the New keyword or the CreateObject function. Not available within ActiveX Control projects.

PublicNotCreateable

The default property value for classes within ActiveX Control projects. Although the class has scope (i.e., it's visible) outside the project in which it's defined, it can't be instantiated from outside the project using the New keyword or the CreateObject function.

Private

The default property value for classes within standard EXE projects. The class can't be "seen" outside of the project in which it's defined. Also, the only instancing property available in standard EXE projects.

SingleUse

Every call by a client to create the object using either the New keyword or the CreateObject function creates a completely ...

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.