通过 VBA 删除 Word 模板的内部链接
我正在尝试创建一个小型 VB 应用程序,删除 Word 文档中与其模板的内部链接。
我找到了这个指南 http://word.tips.net/Pages/T001437_Batch_Template_Changes.html 我正在尝试修改它,以使用 VBA 而不是 Office 内部的宏编程。
但是,我陷入了如何让 Document.Open 工作的困境。任何帮助表示赞赏。
它应该作为独立的应用程序运行,而不是在 Word 中运行。 我正在寻找一种方法来执行宏的功能,但不是从 Word 内部执行。
I'm trying to create a small VB-application that removes the internal link in Word Documents, to their templates.
I have found this guide
http://word.tips.net/Pages/T001437_Batch_Template_Changes.html
and am trying to modify it, to use with VBA instead of Macro programming inside of Office.
However, I'm getting stuck on how to get the Document.Open to work. Any help is appreciated.
This is supposed to run as a free-standing application, and not runt from within Word.
I'm looking for a way to perform what the Macro does, but not from within Word.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有两个坏消息要告诉大家。
1)文档必须有模板。您无法删除它,只能将其更改为其他内容。
2)无论如何,更改模板没有任何作用。请参阅此页面。
我想知道 Open 方法的问题是否是您正在尝试打开“.doc”扩展文件,而不是现代的“.docx”扩展文件。您链接到的 VBA 子例程仅处理“.doc”文件。此 VBA 代码执行以下两项操作:
There are two pieces of bad news to give here.
1) A document has to have a template. You cannot remove it, only change it to something else.
2) Changing a template does nothing anyway. See this page.
I am wonder if the problem with the Open method is that you are trying to open ".doc" extension files, not the modern ".docx" extension files. The VBA subroutine you linked to only does ".doc" files. This VBA code does both:
答案之间的时间很长,但可能对其他人有用。如果您有权访问 Word 文档的 VBE [Alt F11],并且想要删除引用,请转到“工具/引用”[顶部菜单],然后从引用文件列表中取消选择它。我遇到了类似的问题,模板不再存在,但它仍然在项目窗口中被“引用”,所以我执行了上述操作。
long time between answers but may be useful to others. If you have access to the VBE of the Word document [Alt F11], and you want to remove the reference then go to "Tools/References" [top menu] and deselect it from the list of reference files. I had a similar issue where template no longer existed, but it was still being 'referenced' in the Project window, so I did the above.