Saving a UserForm means exporting it from the Visual Basic Editor to a file on disk and then keeping your workbook saved alongside it. A UserForm lives inside the workbook file, so Ctrl+S in Excel does preserve it, but exporting gives you a portable copy you can re-import into another workbook, keep as a backup, or move to a different project. The shortest working routine: open the Visual Basic Editor, select the form in the Project Explorer, use File > Export File, save the .frm file somewhere you control, then also save the workbook itself as a macro-enabled file (.xlsm).
Labels in the Visual Basic Editor can differ slightly by version, and the export dialog wording may vary a little by locale, but the menu names below are the standard ones on Windows desktop Excel. Note that the VBA editor with UserForm designer is a Windows desktop feature; on Mac Excel the editor exists but the UserForm designer is not available in the same way, so plan to do this on Windows.
What You'll Need
- Excel for Windows (the desktop app, not the web version), with the Visual Basic Editor available.
- A workbook that already contains at least one UserForm. Forms cannot be created in Excel for the web.
- Your macro security settings set so that macros can run, or you will not be able to open the form or the project at all. Check under File > Options > Trust Center > Trust Center Settings > Macro Settings.
- A folder where you will keep exported form files, ideally one you back up, not your Desktop.
Step-by-Step
- Save the workbook first. Press Ctrl+S in Excel before touching anything in the editor. If the workbook has never been saved, save it now as an Excel Macro-Enabled Workbook (
.xlsm). A plain.xlsxfile cannot store VBA code or forms, and Excel will silently offer to strip them when you save. - Open the Visual Basic Editor. Press Alt+F11 in Excel. Alternatively, on the ribbon use Developer > Visual Basic. If the Developer tab is not visible, enable it under File > Options > Customize Ribbon and tick Developer in the right-hand list.
- Find the form in the Project Explorer. The Project Explorer is the tree panel, usually top left. If it is hidden, use View > Project Explorer. Expand your workbook node, then expand the Forms folder, and you will see your UserForm listed by name, for example
UserForm1. - Select the form itself, not its code module. Click the entry directly under Forms. When you do, the form designer canvas opens. Do not click the form's code window entry by mistake; exporting works either way, but selecting the form makes it obvious which object you are exporting.
- Export the form. With the form selected, choose File > Export File from the editor's menu bar. A Save As dialog appears. Pick your backup folder, give the file a meaningful name such as
frmCustomerEntry.frm, and click Save. Do not rename the extension. - Repeat for any additional forms. Export each UserForm in the project individually. There is no built-in command that exports every form in one action.
- Export the related code modules too. Right-click any standard module, class module, or the
ThisWorkbookobject in the Project Explorer, choose Export File, and save it with a.bas(standard module) or.cls(class and worksheet/document modules) extension. A form rarely works alone; its button handlers often call routines stored in standard modules. - Understand what the export produces. The
.frmfile is a plain text file. It stores the form's layout and the property lines that describe each control, and the VBA code behind the form is appended in the same file below the layout block. There is normally no separate.frxfile unless the form contains binary content such as an image or an OLE object; if one is generated, keep it next to the.frmbecause the two belong together. - Save the workbook again. Press Ctrl+S inside the editor (this saves the whole workbook) or switch back to Excel and press Ctrl+S. Confirm the file type is
.xlsmor.xlsb. The form is stored in the workbook itself, so this is your primary save; the export is your portable copy. - Verify the export. Open the exported
.frmfile in Notepad. You should see a block ofVERSIONandBegin VB.Formlines near the top, followed by your control definitions, and then your Sub and Function procedures further down. If the file is empty or you only see layout lines, the code did not come along and you should redo the export from the form itself. - Test that you can restore it. In a scratch copy of the workbook, open the editor, use File > Import File, select your
.frmfile, and confirm the form appears in the Project Explorer with its controls intact. This proves the backup is usable before you rely on it.
Common Mistakes
Saving as .xlsx. This is the single most common loss. Excel accepts the save and warns afterwards that some features cannot be kept, but if you click through the warning the form and all code are gone. Always use Save As and pick the macro-enabled format explicitly.
Copying only the code window text. Pasting the form's code into a text file preserves the procedures but loses the form layout, every control, and every property. Rebuilding a form by hand from pasted code is slow and error-prone.
Exporting one form and assuming the project is backed up. A project usually has several forms plus modules. Export each piece, or better, keep the whole workbook in version control or a dated backup folder.
Losing the .frx companion file. If your form contains an image, an icon, or an embedded object and a companion binary file is created, importing the .frm alone can fail or drop the picture. Keep the pair together.
Editing the exported .frm by hand and re-importing. The layout block has strict structure. A stray character in the control definitions can stop the import. Edit code in the editor instead, then export again.
Assuming the export saves the workbook. Exporting a form does not save your Excel file. Both actions are separate and you need both.
Tips
- Give exported forms descriptive names and add a version suffix, such as
frmInvoice_v3.frm, so you can step back to an earlier copy. - Keep a
READMEtext file in the export folder listing which forms and modules belong to which workbook. Six months later this saves real time. - Use the Properties window (F4) to rename a form or controls with a clear prefix before exporting, so the exported object names make sense on their own.
- Distribute the completed workbook itself to other users, not the exported
.frmfiles. They need the workbook with the form already inside. - Remember that a workbook delivered with a form needs its code-signed or trusted location set up on the receiving machine, otherwise macros and forms may be blocked.
Troubleshooting
The export command is greyed out. Nothing valid is selected. Click the form name under Forms in the Project Explorer, then retry File > Export File.
No Forms folder appears in Project Explorer. Either the workbook has no form yet, or you are looking at a different project. Check the tree header matches your workbook name, and confirm on Mac Excel that the form designer is available at all.
You saved over the .xlsm with an .xlsx and the form vanished. Restore from a previous version if Windows or your cloud drive keeps them, reopen that copy, and export the form immediately. If no earlier copy exists, the form has to be rebuilt.
Import fails with an error. The .frm file may be truncated or paired with a missing .frx. Re-export from a working workbook, and import into a project that does not already contain a form with the same object name.
The form opens but a button does nothing. The click handler calls a routine that lives in a standard module you did not export or import. Bring the modules across as well, and check for name clashes if the target workbook already has a module with the same name.
If that did not work, restart Excel, reopen the workbook with macros enabled, and repeat the export. Save to a simple local folder path rather than a network drive or a folder synced by a cloud client, which can interfere with file dialogs.
Frequently Asked Questions
Does Ctrl+S in Excel save my UserForm?
Yes. The form and its code are stored inside the workbook, so saving the workbook as .xlsm saves the form. Exporting is an extra step for portability and backup, not a replacement.
Where is a UserForm stored in the workbook file?
Inside the workbook's VBA project. It is not visible as a separate sheet or file, which is why the workbook must stay macro-enabled.
Can I email someone a .frm file and have them use it?
They would have to import it into a macro-enabled workbook in the VBA editor. It is usually simpler to send the workbook with the form already inside and tell them to enable macros.
Does exporting a form remove it from my workbook?
No. Export writes a copy to disk; the original stays in the project.
Why did two files appear when I exported?
A companion binary file is created when the form contains images or embedded objects. Keep both files together and import the .frm.
Can I save a UserForm in Excel for the web?
No. Forms require the desktop Visual Basic Editor on Windows; the web app cannot create or export them.