Import Method

Applies To

VBComponents collection.

Description

Adds a component to a project from a file; returns the newly added component.

Syntax

object.Import(filename) As VBComponent

The Import syntax has these parts.

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

filename

Required. A String specifying path and file name of the component that you want to import the component from.


Remarks

You can use the Import method to add a component, form, module, class, and so on, to your project.

See Also

Export method.

Example

The following example uses the Import method on the VBComponents collection to copy the contents of the test.bas file into the a code module.

Application.VBE.ActiveVBProject.VBComponents.Import("test.bas")