vba Microsoft Word 全局模板中丢失的宏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16833261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Lost Macros in Microsoft Word Global Template
提问by khargushoghli
All the macros I stored in the Normal.dotm global template of my Word 2007 document are gone except one minor one. This is the second time this has happened to me. (I know, I should've learned from the first time.)
我存储在 Word 2007 文档的 Normal.dotm 全局模板中的所有宏都消失了,除了一个小宏。这是我第二次遇到这种情况。(我知道,我应该从第一次开始学习。)
Is there any way to recover them? Is there any way to prevent this from happening in the future?
有什么办法可以恢复它们吗?有什么办法可以防止将来发生这种情况吗?
回答by Jose Ospina
Go to \Users\YOURUSER\AppData\Roaming\Microsoft\Templates and see if there is a Normal.dotm.old or .bak files. Rename them and see if your lost data is there.
转到 \Users\YOURUSER\AppData\Roaming\Microsoft\Templates 并查看是否有 Normal.dotm.old 或 .bak 文件。重命名它们并查看丢失的数据是否在那里。
It worked for me too!
它也对我有用!
回答by Catherine Combs
I had the same issue. For security purposes, our IT department has a program that each evening wipes out almost all of the macros saved to Normal.dotm on each individual's computer.
我遇到过同样的问题。出于安全考虑,我们的 IT 部门有一个程序,每天晚上都会清除每个人计算机上保存到 Normal.dotm 的几乎所有宏。
You will need to setup a Word Template that is Macro Enabled. Any macros you create need to be built directly in this template. You can do this by going into Word and selecting "File" and then "Open" instead of clicking on the template file on your server or desktop.
您将需要设置启用宏的 Word 模板。您创建的任何宏都需要直接在此模板中构建。您可以通过进入 Word 并选择“文件”然后“打开”而不是单击服务器或桌面上的模板文件来执行此操作。
回答by Galen Currah
Once your macros are back, while Word is active:
一旦您的宏恢复,而 Word 处于活动状态:
- Press Alt+F11 to open your Macro manager.
- In the left-hand pane, see the items under Modules.
- This or these item(s) contain(s) macro(s).
- Right click on each item and choose "Export file..."
- Save the file to a safe place that you an remember. (You can write a macro to do all of this!)
- 按 Alt+F11 打开宏管理器。
- 在左侧窗格中,查看模块下的项目。
- 此或这些项目包含宏。
- 右键单击每个项目并选择“导出文件...”
- 将文件保存到您记得的安全位置。(您可以编写一个宏来完成所有这些!)
When you lose your macros again, restore them:
当您再次丢失宏时,请恢复它们:
- Press Alt+F11 to open your Macro manager.
- In the left-hand pane, right-click on "Modules".
- Chose "Import file..."
- Navigate to your saved macros file and open it.
- 按 Alt+F11 打开宏管理器。
- 在左侧窗格中,右键单击“模块”。
- 选择“导入文件...”
- 导航到您保存的宏文件并打开它。