How To Enable Macros In Excel

When I run an excel macro module in VBA, it shows the error dialog with the error message The macros in this project are disabled. This is because excel disables the macros from executing by default for security reasons. This article will tell you how to enable macros in excel and how to disable macros in excel VBA source code as well.

1. How To Enable Macros In Excel.

  1. Sometimes when you open an excel file, you can see a yellow SECURITY WARNING message on the top area, and there is a button with the text Enable Content.
  2. After you click the Enable Content button, you can find that you can run the macro in the VBA window.
  3. The above action will make excel trust the excel workbook file so that it enables macros in excel files also.
  4. If you do not see the above message, you can follow the below steps to enable macros in excel.
  5. Open the excel workbook, then click the File tab on the excel workbook top area.
  6. Then click the Options item on the bottom left corner of the excel window.
  7. In the popup Excel Options dialog window, click the Trust Center item on the bottom left of the dialog.
  8. Then click the Trust Center Settings… button on the dialog right side bottom right corner.
  9. It will open the Trust Center dialog window.
  10. Click the Macro Settings item on the left side.
  11. Then you can see a list of the Macro Settings radio button on the right side.
  12. By default, the radio button Disable all macros with notification is selected.
  13. If you want to run the macros in your VBA window, you should select the Enable all macros radio button.
  14. But this action is not recommended, so before you select it, you had better backup your excel file.
  15. You can also check the checkbox Trust access to the VBA project object model in the Developer Macro Settings area.
  16. This will enable the macros when you develop it in VBA source code also.

2. How To Enable Macros In Excel For Specified Excel Files ( Recommended ).

  1. The above settings will enable macros in excel globally, which means it will enable macros for all the excel files.
  2. If you only want to enable macros in excel for specified excel files, you can follow the below steps.
  3. Open the Trust Center dialog window as in section 1.
  4. Click the Trusted Locations item on the left side.
  5. Click the Add new location… button on the dialog right side.
  6. It will open the Microsoft Office Trusted Location dialog.
  7. Click the Browse… button to select the location folder path.
  8. If you also trust the subfolders of the selected location then check the checkbox Subfolders of this location are also trusted.
  9. You can also add some description in the Description text area.
  10. Click the OK button to save the changes.
  11. Then only the excel files that are saved in the trusted location folder and it’s subfolder can run the macros.
  12. When you run the macros in the excel file that is saved in the above folder, the warning message will disappear.

3. How To Disable Macros In Excel.

  1. If you enable macros in excel by the methods in section 1, then you can select the radio button Disable all macros with notification in the Trust Center dialog Macro Settings area.
  2. If you enable macros in excel by the methods in section 2, then you can move the excel file out of the trusted location folder to disable the macro to run.
  3. Or you can remove the location folder from the Trust Center —> Trusted Locations path list, then the macros will be disabled to run.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.