Search notes:

VB Editor Object Model: VBComponent

A vbComponent object represents a VBA module, a class, a form or (?) a standalone project, see also the corresponding (?) vbext_ct_* constants for the add method of the vbComponents object.
The VBA source code that is associated with a vbComponent is represented by a codeModule object.

Creating a vbComponent from a source file

A vbComponent can be created from a source file with
dim mdl as vbide.vbComponent

set mdl  = application.VBE.activeVBProject.vbComponents.import("P:\ath\to\some\source\code\file.bas")
mdl.name = "Foo bar baz Module"
Compare with codeModule.addFromFile

Showing a component

A component can be shown (that is: activated) with a command like so:
application.VBE.activeVBProject.vbComponents("shCoverData").activate

Properties

Properties of vbComponent are
codeModule returns the codeModule object that is associated with a component.
collection
designer An UserForm object if the vbComponent is a form.
designerID A string (whose value appears to be Forms.Form, at least in «normal» situations)
hasOpenDesigner
name
properties A collection of property objects. For forms, it seems that hasOpenDesigner must be true in order for this collection to be valid.
saved
type
vbe

Methods

Methods of vbComponent are
activate
designerWindow
export Compare with vbComponents.import

See also

The 00_ModuleLoader module, especially the functions loadOrReplaceModuleWithFile and loadModuleFromFile.
The vbComponents object of the The VB Editor object model

Index