11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

602<br />

Part VI: Developing Custom Worksheet Functions<br />

Figure 22-4: You see this warning when the VBA window is open and a workbook contains macros.<br />

Saving Workbooks That Contain Macros<br />

If you store one or more VBA macros in a workbook, you must save the file with macros enabled.<br />

This is a file with an XLSM extension (or XLAM extension if it’s an add-in). This file format is not<br />

the default format, so you need to make sure that you save the file with the correct extension.<br />

For example, assume that you create a new workbook containing one or more macros. The first<br />

time you save the workbook, the file format defaults to XLSX, which is a file format that cannot<br />

contain macros. Unless you change the file format to XLSM, Excel displays the warning shown in<br />

Figure 22-5. You need to click No, and then select Excel Macro-Enabled Workbook (*.xlsm) from<br />

the Save as Type drop-down list.<br />

Be careful because Excel makes it very easy to accidentally delete all your macros<br />

with a single button click. If you accidentally click Yes instead of No, Excel deletes the<br />

macros from the saved workbook. The macros are still available in the copy that you’re<br />

working on, however. So if you catch your mistake, it’s still not too late to resave<br />

the workbook with an XLSM extension.<br />

Figure 22-5: Excel warns you if your workbook contains macros and you attempt to save it in a nonmacro<br />

file format.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!