Export your VBA code for use in another Excel application

After creating UserForm1 for one Excel application, you realize that you'll want to use it again -- with a few modifications -- in another application. You do not need to recreate the form; simply export the code to a file that you can import later to the new application. Mary Ann Richardson explains how.

After creating UserForm1 for one Excel application, you realize that you'll want to use it again (with a few modifications) in another application. You do not need to recreate the form — simply export the code to a file that you can import later to the new application. Follow these steps to export the code:

Open the workbook that contains the code you want to export.

Press [Alt][F11].

Right-click UserForm1 in the Project Explorer.

Select Export File.

Navigate to the folder where you want to save your form.

Give the file a name and click Save.

To import the form into another application, follow these steps:

Open the workbook that contains the code for your new application.

Press [Alt][F11].

Right-click the project name in the Project-VBA Project window.

Select Import File.

Navigate to the file you want to import.

Click Open.

You can use these steps to export or import any Excel VBA Project object.