Starting from the 2007 version of the office, when saving a workbook containingfor the first time, Excel will prompt “cannot be saved in macro-free workbooks”.
This is because the workbook containing VBA code must be saved as a macro-enabled workbook type. Excel provides an xlsm type workbook for this purpose, which is called “macro-enabled workbook”.
Save Macro-enabled Workbook
When saving for the first time, the aforementioned prompt box will pop up. In order to save the VBA code, select “No” among them. In the Save As window, select “Excel Macro-Enabled Workbook (*.xlsm)” in the Save Type list.
After saving, you will find the workbook type from xlsx becomes xlsm.