You are currently offline, waiting for your internet to reconnect

How To Make VBA Class Modules Available Out-of-Process

This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how you can make a Visual Basic for Applications (VBA) Class Module available out-of-process.
More information
In certain situations, it may be useful to make instances of a VBA Class Module available out-of-process. However, VBA Class Modules are marked private by default, meaning that their type information is not available for marshalling purposes. In order to correct this, the instancing property of the VBA Class Module must be changed from Private to Public, Non-creatable.

The instancing parameter can also be changed programmatically, using the VBA Extensibility library. The following VB/APC code demonstrates this scenario. It assumes you have a variable called TheProject of typeMSAPC.Project):
Dim TheProjectItem As MSAPC.ProjectItemSet TheProjectItem = TheProject.ProjectItems.AddClassModule("Class1")TheProjectItem.VBComponent.Properties("Instancing").Value = 2				

Article ID: 244075 - Last Review: 12/05/2015 16:19:41 - Revision: 2.0

  • kbnosurvey kbarchive kbhowto KB244075