With the advent of Excel 2007 Microsoft introduced new file extensions for Excel. Instead of having only .xls for all workbooks we now have .xlsb for Excel Binary Workbooks, .xlsm for Excel Macro-Enabled Workbooks, .xlsx for Excel Workbooks and a multitude of other formats from Templates to Text. One of the potential issues of these different formats when using Macros is the loss of the Macros when the workbook is not saved as a Macro-Enabled Workbook. Even though the User receives a message that the Macros will be removed the message is often ignored resulting in a copy of the workbook minus the original Macros.
One solution to this issue is to prevent users from saving your workbook with any file extension other than .xlsm. The code below will prevent this.
This code has to be in the Workbook module rather than a regular module. To access the Workbook module click the Developer tab and then click the Visual Basic icon to display display the Visual Basic editor.
Right click on ThisWorkbook and select View Code
Enter the code in the the Worksheet Module, close the editor and save the workbook.
If you have questions regarding this let me know and I'd be happy to help if I can.
No comments:
Post a Comment