本文转自:https://www.ablebits.com/office-addins-blog/2014/07/22/enable-macros-excel/#always-run-macros

This tutorial teaches how to enable macros in Excel 2010-2013. You'll also find step-by-step instructions showing how to disable macros in Excel or turn them on via Message bar and Backstage view. In addition you'll find a tip to run a macro even if all macros are disabled and get a link to a piece of code that gets users enable macros in a workbook.

First off, I'd like to share a brief intro to Excel macros and security risk linked to enabling them. A macro is a series of commands assembled together and designed to automate frequent routine tasks in Excel. You can run macros any time to perform certain actions.

Many macros are created using Visual Basic for Applications, or VBA. Lots of Excel users can record simple macros to streamline their work with spreadsheets. Developers create codes that are more complicated.

When enabling a macro in Excel that was written by someone else, you need to remember that it can carry a potential security risk. A person with malicious intent, like hacker, can make a destructive macro to spread a virus on your PC or network.

Read on to find detailed descriptions of macro settings, steps to enable Excel macros and save a macro-enabled workbook. You can also click any of the links below to get straight to the point.

How to enable macros in Excel from the Message Bar

If you open an Excel document that contains macros, you'll see the yellow Message Bar with a shield icon and the Enable Content button.

If you are sure, the macros are from a trustworthy source, just press the Enable Content button on the bar.


The file will be opened as a trusted document and the security warning will disappear.

Excel - enable macros via the Backstage view

You can also enable macros in Excel using the Microsoft Office Backstage view. You can see the yellow Message Bar if you click the File tab.

  1. Click on the File tab.
  2. You'll see the yellow Security Warning area. Click Enable Content.
  3. You will see 2 features: Enable All Content and Advanced Options. Select Enable All Content to always make the document's active content available.

The current Excel file will become a trusted document and all macros will be enabled.

How to always run macros for a trusted worksheet

If you create and share workbooks with macros you may want to avoid getting the security message every time. If you get all your workbooks only from reliable sources, you can choose to instantly run all macros for all publishers. Below you'll see how to enable all macros in Excel by default.

  1. Go to File -> Options -> Trust Center and press the Trust Center Settings ... button.

    Tip. You can also click on the Trust Center Settings link on the Security Warning.
  2. You will see the Trust Center window. Select the Macro Settings option.
  3. Select the radio button Enable all macros (not recommended, potentially dangerous code can run).

From now on all macros will run without warning.

Please note that this setting makes your computer open to viruses. You should be sure you get all workbooks with macros only from the trusted publishers.

Adjust macro settings on the Trust Center window

You can find all macro settings on the Trust Center window. These settings let you adjust the way you want to work with macro-enabled workbooks.

Follow the steps from How to always run macros for a trusted worksheet to get the Trust Center window.

Please see all the macro settings explained below:

  • Disable all macros without notification. Macros and security alerts regarding them get turned off.
  • Disable all macros with notification. If you select this radio button, macros will be disabled, but security alerts will appear if there are macros in a file. It lets you enable macros in Excel depending on the source.
  • Disable all macros except digitally signed macros. In this case, macros are turned off, security alerts appear and digitally signed by a trusted publisher macros run. If you have not trusted the publisher, you are offered to enable the signed macro and trust the publisher.
  • Enable all macros (not recommended, potentially dangerous code can run). All macros run without warning. Please note that this setting makes your computer open to viruses.
  • Trust access to the VBA project object model. This checkbox forbids or allows programmatic access to the Visual Basic for Applications (VBA) object model from an automation client. This security setting is for the code that computerizes an Office program and manipulates VBA environment and object model. For automation clients to access the VBA object model, the user running the code must grant access. You need to tick the check box to give access.

Run a macro even if all macros are disabled

Say the setting Disable all macros without notification is turned on your PC, but you need to run certain macro here and now. If you have Excel 2007-2013, you can enable macros even if your security settings don't allow this. The point is that Excel sees certain locations as trusted zones. This means if you store your macro-enabled files there, the security check can be omitted and the macro will run.

Please see the list of these trusted locations below:

Program Files\Microsoft Office\Templates

Program Files\Microsoft Office\Office12\Startup

Program Files\Microsoft Office\Office12\Library

Program Files\Microsoft Office\Office12\XLSTART

You can add any location on your PC to the trusted zone, by following the steps below:

  1. In Excel navigate to the File tab -> Options -> Trust Center -> Trust Center Settings -> Trusted Locations.
  2. Click on the Add new location button to see the Microsoft Office Trusted Location dialog box.
  3. Click Browse to search for the needed place on your PC.
Note. Before adding any location to trusted, make sure it's really safe since such location can be attacked by hackers.

How to save a macro in a workbook

Macros need you to save the files in a new macro-enabled workbook format. This type adds security warning to your file. If you don't choose the correcttype, the command will not be kept. Below you'll find how to save a macro-enabled Excel document:

  1. Navigate to File -> Save As and browse for the necessary location on your PC.
  2. Click on the Save as type: arrow and select the Excel Macro-Enabled Workbook from the list of types.
  3. Click Save to keep the results.

If you forget to select the type of Macro Enabled Workbook, you'll get a warning message notifying that the macro will not be saved:

Click No if you need to keep the macro.

How to disable macros in Excel 2010-2013

Suppose, you only proofread the files and don't need macros enabled on your PC. You get documents from various sources and prefer to set your security settings to the highest level. Since some macros can be potentially dangerous, you can disable them all using the Trust Center options.

  1. Follow the steps from How to always run macros for a trusted worksheet to get the Trust Center window.
  2. Select the Disable all macros without notification or Disable all macros with notification radio button. If you go for the first option, you will not know if there are any macros in the current file. The second button lets you identify Excel workbooks that contain macros.

Use special code to make users enable macros in a workbook

The code from this article forces a user to enable macros in a workbook. This code hides all sheets until the macro is enabled. It also adds a warning sheet that alerts the user to run macros. As soon as a user turns the commands on, the warning sheet is hidden and all other content is shown.

  1. Add the code to your workbook.
  2. Create a new sheet named "Warning".
  3. Add a message on the worksheet asking the user to re-open the workbook and enable macros.
  4. Finally, save your workbook.

You may also be interested in

Check out Tutorial with Excel examples about Macros for some nice and simple samples to automate your daily spreadsheet tasks.

If you are starting to learn macros, read How to insert and run VBA code in Excel - tutorial for beginners.

That's all about enabling and disabling macros in Excel. Hope you've found the information helpful. Feel free to leave your questions in the comments below. Be happy and excel in Excel!

[转]How to enable macros in Excel 2016, 2013, and 2010的更多相关文章

  1. Excel 2016 密码保护破解

    Excel 2016的密码保护可以区分为几个: 文件密码保护(Excel中叫做工作簿保护) 文件打开权限密码 文件修改权限密码 工作表保护 关于各个保护密码的设置方式请查阅其他资料,我的情况是之前自己 ...

  2. 关于Excel 2016 总要点击两次才能打开的解决方法

    1.快捷键:win+r,输入:regedit2.定位到如下项目“HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command”:3.编辑原有的内容,在最后添加 ...

  3. Excel 2016在大数据分析领域有了很多的改善

    Excel 2016在大数据分析领域有了很多的改善 通常,我们会把大数据分析的整个过程分为五个阶段: 获取获取,数据分析,可视化,发布报告,应用报告. 在获取数据方面,Excel 2016相对Exce ...

  4. Word、Excel、PPT 2016、2013、2010、2007 没有保存或断电导致文件丢失怎么恢复?

    1. 前言 没有保存文档还能恢复吗?死机.断电.蓝屏导致来不及保存文档,还能恢复吗?答案当然是可以的!Office中本身就有恢复文档的功能,可以帮助我们最大化的挽回损失. Office2013与Off ...

  5. Excel 2016 Power View选项卡不显示的问题

    https://zhuanlan.zhihu.com/p/43543442 PowerView是Excel中的Power系列插件之一,可以基于excel制作交互式仪表板. 初学者在使用Power Vi ...

  6. Excel 2016 for Mac

    1. Excel for Mac 的 Developer tab下没有XML组,因此无法从xml导入或者导出到xml: 2. Excel for Mac 中没有Mark as Finnal的功能: 3 ...

  7. 方法二:Excel 2016 VBA工程密码破解

    将你要破解的Excel文件关闭,切记一定要关闭呀!然后新建一个Excel文件 打开新建的这个Excel,按下alt+F11,打开vb界面,新建一个模块,如图所示 将代码复制到这个模块中,代码如下:Pr ...

  8. Excel 2016双击文件打开后是空白,再次双击才能打开(或者通过文件,打开才能打开)

    问题描述: 直接双击excel文件打开后是空白的,几乎所有功能都无法使用.但是再次双击该文件能够打开,或者通过文件 --> 打开的方式才能打开. 虽说能够打开文件,但是对于咱们这种追求完美的人来 ...

  9. excel 2016 for mac破解

    1: 首先去官网下载一个正版的: 2:再下载一个破解工具: 链接: http://pan.baidu.com/s/1i4AFHFf 密码: 3yf8 3:最后按照破解教程破解: http://jing ...

随机推荐

  1. wx-一个简单页面

    一个具有顶部,底部和中间的html页面,但没有js <view class="root"> <!-- 标签栏的页签 固定高度 --> <view cl ...

  2. 《Dotnet9》系列之建站-中文站最好WordPress主题,自媒体,博客,企业,商城主题一网打尽

    大家好,我是Dotnet9小编,一个从事dotnet开发8年+的程序员.本文介绍WordPress主题JustNews,本站Dotnet9既是使用WordPress + JustNews主题搭建而成的 ...

  3. iOS 13 presentViewController

    升级了iOS 13,发现代码中使用presentViewController的都变成了这样的,顶部留了一部分 查看present样式,iOS 13 默认自动适配,需要在present的时候,设置sty ...

  4. Git很麻烦?只要掌握这几个命令,轻松将代码提交远程仓库

    在上一章节,跟大家介绍了拉取代码的操作,简单暴力.这一章节要介绍的是如何将现有的项目,直接提交到仓库. 现在,如果大家有一个项目要提交到GitHub仓库,安装上一张的方法,需要先在GitHub上建一个 ...

  5. Git常用进阶操作之一

    提起Git,经常做项目的我们都不陌生,我们常用的功能有哪些呢? 这里按个人使用情况简单总结一下. 像新建远程仓库.新建分支这些就不说了,不熟的同学可以翻看我前面写的git基本操作. 1.首先提一下为每 ...

  6. Go学习笔记(持续更中,参考go编程基础,go边看边练)

    使用关键字 var 定义变量,自动初始化为零值.如果提供初始化值,可省略变量类型. 在函数内部,可用更简略的 := 方式定义变量.空白符号_ package main import "fmt ...

  7. 用Python6种方法:给定一个不超过5位的正整数,判断有几位

    方法一:作比较 a=int(input(">>>>")) if a<10: print(1) elif a<100: #第一个条件已经过滤了大于 ...

  8. 推荐一款好看的Hexo主题Ayer

    介绍 Ayer 是一个干净且优雅的Hexo主题,自带响应式,加载速度很快,该有的功能都有,可配置项也很多,非常适合作为你的博客主题,主题内还附送了6张精美的高清壁纸.欢迎使用和Star支持,如果你在使 ...

  9. jquery 实现只能选中一个checkbox,选中当前的去除上一个

    jq 实现只能选中一个checkbox,选中当前的去除上一个. <div id="checkboxed"> <input name="check1&qu ...

  10. OSG嵌入QT的简明总结

    目录 1.解决方案 2.存在问题 1) 警告提示 2) 多线程问题 3) 其他 1.解决方案 不得不说关于OSG的资料实在太零散了,搜索了很多关于OSG在QT下的解决方案,都是各有各的说法,有的说的不 ...