How to save workbooks that contain Macros


For example, we want to create e VBA macro that will insert the current date into the active cell, then applies a date format, makes the cell bold, We named the Macro as CurrentDate

The first time you want to save this workbook (containing macro CurrentDate), the file format defaults to XLSX — and this format can’t contain macros. Unless you change the file format to XLSM, Excel displays the warning shown in the following figure.

Excel will warn you if your workbook contains macros and you attempt to save it in a non-macro file format.

You need to click No, and then choose Excel Macro-Enabled Workbook (*.xlsm) from the Save As type drop-down list in the Save As dialog box.


Note: Alternatively, you can save the workbook in the old Excel 97–2003 format (which uses an XLS extension) or the new Excel binary format (which uses an XLSB extension). Both of these file formats can contain macros.

Post a Comment

0 Comments