Export your VBA code for use in another Excel application - TechRepublic

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.

Oct 29, 2007
We may earn from vendors via affiliate links or sponsorships. This might affect product placement on our site, but not the content of our reviews. See our Terms of Use for details.

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:

  1. Open the workbook that contains the code you want to export.
  2. Press [Alt][F11].
  3. Right-click UserForm1 in the Project Explorer.
  4. Select Export File.
  5. Navigate to the folder where you want to save your form.
  6. Give the file a name and click Save.

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

  1. Open the workbook that contains the code for your new application.
  2. Press [Alt][F11].
  3. Right-click the project name in the Project-VBA Project window.
  4. Select Import File.
  5. Navigate to the file you want to import.
  6. Click Open.

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

Miss an Excel tip?

Check out the Microsoft Excel archive, and catch up on other Excel tips.

Help users increase productivity by automatically signing up for TechRepublic’s free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.