Monday, February 1, 2010

Get Rid of the "Enable Macros" Notice

Have you ever opened an Excel Workbook that no longer contains macros but it still prompts you to "Enable or Disable Macros"? 

Here's why:
When a macro is created, Excel adds a module to the workbook to store the macro.  When you delete all the macros in the workbook the module does not get deleted.
Note: A macro is a recording of a set of commands. Once a macro is recorded you can simply type the macro's name instead of typing the complicated sequence of commands, and all the commands automatically run that you have recorded.

How to delete the Module:
  1. Open the Excel file that no longer contains the macro.
  2. Press Alt+F11 (function key at top of keyboard) to display the Visual Basic Editor.
  3. Near the upper-left side of the editor is the Project Explorer. This contains a hierarchical tree that shows the workbook name and the different modules in your workbook. If the Project Explorer is not visible on your screen, press Ctrl+R to display it.
  4. Within the Project Explorer should be a folder called Modules. If it is not already open, double-click on the Modules folder to display its contents.
  5. Right-click on a module in the folder. A menu is displayed. (See picture below.)
  6. Choose the Remove option from the menu. You are asked if you want to export the module before removing it.
  7. Click on the No button. The module is removed.
  8. Repeat  steps 5 through 7 for each module in the Modules folder under your workbook name.
  9. Close the Visual Basic Editor.
  10. Save your workbook.
At this point your workbook contains no modules, and you will not get any notification when you subsequently open it.