Except for those listed under the References node, every object in a project can be saved to a separate file. Saving an individual object in a project is called exporting. And it stands to reason that you can also import objects into a project. Exporting and importing objects might be useful if you want to use a particular object (such as a VBA module or a UserForm) in a different project.
To export an object, select it in the Project Explorer window and choose File
Export File (or press
Ctrl+E). You get a dialog box that asks for a filename. Note that the object remains in the project (only a copy of it is exported). If you export a UserForm object, any code associated with the UserForm is also exported.
To import a file into a project, select the project's name in the Project Explorer window and choose File
Import File. You get a dialog box that asks for a file. You can import only a file that has been exported by choosing the File
Tip If you would like to copy a module or UserForm object to another project, it's not really necessary to export and then import the object. Make sure that both projects are open; then simply activate the Project Explorer and drag the object from one project to the other.
Was this article helpful?