HOWTO: Make VBA Class Modules Available Out-of-Process

ID: Q244075


The information in this article applies to:
  • Microsoft Visual Basic for Applications (VBA) Software Development Kit (SDK), versions 6.0, 6.1


SUMMARY

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 type MSAPC.Project):


Dim TheProjectItem As MSAPC.ProjectItem

Set TheProjectItem = TheProject.ProjectItems.AddClassModule("Class1")

TheProjectItem.VBComponent.Properties("Instancing").Value = 2 

Additional query words:

Keywords : kbSDKVBA kbGrpDSO kbDSupport
Version : winnt:6.0,6.1
Platform : winnt
Issue type : kbhowto


Last Reviewed: November 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.