Keep Microsoft Word from adding files opened programmatically to its History

折月煮酒 提交于 2020-01-16 18:41:09

问题


I have a .NET program that opens a file programmatically in word to modify it. Unfortunately, Microsoft word keeps the times the file was opened in word in its History, even though I don't want that to happen when the file is opened programmatically.

How can I keep this from happening in .NET?


回答1:


If you are using Documents.Open or SaveAs you can set the AddToRecentFiles property like this:

Open:

Globals.ThisAddIn.Application.Documents.Open("filename", AddToRecentFiles: false);

Save as:

Globals.ThisAddIn.Application.ActiveDocument.SaveAs2("filename", AddToRecentFiles: false);


来源:https://stackoverflow.com/questions/23059858/keep-microsoft-word-from-adding-files-opened-programmatically-to-its-history

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!