Saving Your Recorded Macro

When you record a macro, it is automatically saved in the location you chose when you started the Macro Recorder. It is not permanently saved, however, until the workbook you chose to store the macro in is saved to disk.

For example, if you chose This Workbook (that is, the active workbook) in the Record Macro dialog when you started the Macro Recorder, your recorded macro is not permanently saved until you save changes to the active workbook.

If you chose the Personal Macro Workbook as the location in which to store your recorded macro, your macro is not permanently saved until you close Excel. If there are any unsaved changes in Personal.xlsb, Excel prompts you to save those changes when you close Excel.

If you chose This Workbook or New Workbook as the location in which to store your macro, you must change the workbook format from a standard .xlsx file to a macro- enabled workbook format, with the .xlsm extension.

If you try to save a workbook that has macros in it to the standard .xlsx format, Excel will display a warning similar to the one shown in Figure 1.7. If you see this warning, and you want to save your recorded macros, you must click the No button, and save your workbook into the macro-enabled format (.xlsm).

If you have the warning dialog shown in Figure 1.7 on your screen, save your workbook as a macro-enabled workbook by following these steps:

  1. Click No in the warning dialog. Excel returns you to the Save dialog.

  2. In the Save as type list, choose Excel Macro-Enabled Workbook (*.xlsm).

  3. Click the Save button. Excel saves your workbook as a macro-enabled workbook.

If you want to proactively convert or save your workbook in macro-enabled format, follow these steps:

  1. Click the File tab; Excel displays the "backstage" window.

  2. In the column at the left of the backstage window, click Save As. Excel displays the Save As window

  3. Click the folder you want to save your workbook in, or click Browse; Excel displays the Save As file dialog.

  4. In the Save as type list, choose Excel Macro-Enabled Workbook (*.xlsm).

  5. Click the Save button to save your workbook in the macro-enabled format.