如何以编程方式重新启用 MS Office 禁用文件列表中的文档
MS Office 程序保留了以前打开时导致错误的禁用文件的列表。 用户可以通过程序菜单访问该列表并选择要重新启用的文档,从而从此列表中删除文档。 (http://support.microsoft.com/kb/286017)
问题是: 如何在不与 GUI 交互的情况下以编程方式完成文档的重新启用?
MS Office programs keep a list of disabled files that have caused errors when previously opened. A user can remove documents from this list by accessing the list through the program menu and selecting a document to be re-enabled. (http://support.microsoft.com/kb/286017)
The question is: How can this re-enabling of documents be accomplished programmatically, without interaction with the gui?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
整合之前的答案并在这里进行阐述。
Office 产品将禁用的项目存储在注册表中名为
HKEY_CURRENT_USER\Software\Microsoft\Office\\\Resiliency\DisabledItems
的项下。 例如,Excel 2010 的禁用列表位于HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Resiliency\DisabledItems
下。每个禁用的项目都存储为
REG_BINARY
类型的随机命名键。 字节数组的格式为:Consolidating previous answers and expounding upon them here.
Office products store disabled items in the registry under keys named
HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\<product>\Resiliency\DisabledItems
. For example, Excel 2010's disabled list is underHKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Resiliency\DisabledItems
.Each disabled item is stored as a randomly-named key of type
REG_BINARY
. The format of the byte array is:用于重新启用 Excel 2016 中所有“禁用项目”的 BAT 脚本。
禁用项目可在 Excel->文件->选项->插件->管理->禁用项目中找到。
仅供参考:
/va 删除该键下的所有值。
/f 强制删除而不提示。
附言。 我有一堆使用任务计划程序运行宏的工作簿。 Excel 会随机添加崩溃到禁用项目列表中的工作簿。 所以每天运行这个BAT脚本就可以解决问题了。
BAT script to re-enable all "disabled items" in Excel 2016.
Disabled items are found in Excel->File->Options->Addins->Manage->Disabled items.
Fyi on params:
/va Delete all values under this key.
/f Forces the deletion without prompt.
PS. I have a bunch of workbooks that run macros with a task scheduler. Excel would randomly add workbooks that crashed onto the disabled items list. So running this BAT script daily resolves it OK.
这是我整理的一个 Powershell 脚本,用于解决我在 Win7 上使用 MS-Access 2013 时遇到的类似问题
Here is a Powershell Script that I threw together to fit a similar problem I was having with MS-Access 2013 on Win7
对于 MS Office XP (2002) MSWord,禁用文档列表以随机命名的二进制值形式保存在以下键下:
[HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Word\Resiliency\DisabledItems]
因此,删除每个用户的“DisabledItems”键下的值可能会成功。
还有更多的事情吗? 我还不知道。
Regarding MS Office XP (2002) MSWord the list of disabled documents is kept as randomly named binary values under the key:
[HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Word\Resiliency\DisabledItems]
So deleting the values under the "DisabledItems" key for every user probably will do the trick.
Is there something more to it? I don't know - yet.
有一篇关于 Office 如何处理 COMAddins 的好文章,位于 codeproject。 普通插件得到同等处理,并且系统到目前为止保持不变(直到 Office 2013)。
据我所知。 随机命名的值包含一个由 NULL 字符串分隔的 unicode 字符的字节数组。
我无法找到以空分隔的值数组中的所有条目。 但是,索引 (3) 包含 ADDIn 的文件名,索引 (4) 包含 ADDIn 的描述(如果可用)。
因此,正如 Luie 在 2009 年所写的那样,在删除注册表项之前,应该读取这些值并要求用户重新安装插件。
There is a good article about how Office handles COMAddins at codeproject. Normal Addins are handled equally and the system was kept unchanged so far (up to Office 2013).
As far as I found out. The randomly named value contains a byte-array of unicode characters, separated by null-strings.
I could not find out about all the entries in the null-separated array of values. However index (3) contains the filename of the ADDIn and index (4) contains a description of the ADDIn if available.
So one should read the values and ask the user to reinstall the addins before deleting the registry keys as Luie wrote back in 2009.