[Excel VBA] Tired of Enabling Macros Every Time? How to Auto-Enable Them Safely

目次

Background

Every time I open a macro-enabled Excel file (.xlsm), a message bar appears asking, “Enable Content?” If you use macros daily, clicking this button every single time can become annoying. I decided to summarize how to set macros to enable automatically, along with the important security precautions you should know.

Conclusion: It is Possible, but Not Recommended

Excel allows you to change security settings to automatically enable macros. However, this setting poses a very high security risk. It can allow malicious code (malware) to run without your knowledge. Therefore, enabling all macros globally is generally not recommended.

Method: How to Disable Macro Warnings (High Risk)

If you still wish to change this setting, follow the steps below:

  1. Open Excel.
  2. Click the File tab.
  3. Open Options at the bottom left.
  4. Select Trust Center.
  5. Click the Trust Center Settings… button.
  6. Select Macro Settings.
  7. Select Enable VBA macros (not recommended; potentially dangerous code can run).
  8. Click OK to confirm and close all windows.

After applying this setting, Excel will no longer ask for permission and will automatically run macros when you open a file.

Recommended Alternative: Using “Trusted Locations”

A much safer alternative is to set up “Trusted Locations.” This allows macros to run automatically only if the file is saved in a specific folder.

Steps to Set Up a Trusted Location:

  1. Go to Trust Center Settings (same steps as above).
  2. Select Trusted Locations.
  3. Click Add new location….
  4. Browse and select the folder where you save your macro files.
  5. Check “Subfolders of this location are also trusted” if necessary.
  6. Click OK.

With this method, only files within the specified folder will bypass the warning. This balances convenience with security.

Summary

To auto-enable macros, you can select “Enable all macros” in the Macro Settings, but this is dangerous because it allows any macro to run unchecked.

The practical and recommended solution is to use Trusted Locations. This allows you to skip the warning only for files you know are safe.

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

私が勉強したこと、実践したこと、してることを書いているブログです。
主に資産運用について書いていたのですが、
最近はプログラミングに興味があるので、今はそればっかりです。

目次