简体   繁体   English

如何使用宏关闭跟踪的更改?

[英]How Do i turn off tracked changes using macros?

I have been trying to create a macro that will automatically run when I open a new word document that will verify that tracked changes are turned off. 我一直试图创建一个宏,当我打开一个新的Word文档时该宏将自动运行,该文档将验证是否已关闭跟踪的更改。 For some reason, whenever I run a macro that opens a new word document that is a .dotm file that contains a form, it turns on tracked changes and I have not told it to do so. 出于某种原因,每当我运行一个宏以打开一个新的Word文档(该文档是一个包含表单的.dotm文件)时,它都会打开跟踪的更改,而我没有告诉它这样做。

I have tried various different ways of fixing this issue. 我尝试了多种解决此问题的方法。

Before I close the User form that has been opened when I opened the new file, I add this line 在关闭打开新文件时打开的用户表单之前,请添加以下行

 ActiveDocument.TrackRevisions = False

I also tried with an if statement 我也尝试了if语句

if(ActiveDocument.TrackRevisions) then
    ActiveDocument.TrackRevisions = False
end if

I also tried doing it so that it was not even involved in the user form at all but the document itself by inserting it in the "ThisDocument" section under the "Microsoft Word Objects" File. 我也尝试过这样做,以便通过将其插入“ Microsoft Word Objects”文件下的“ ThisDocument”部分中,甚至根本不涉及用户表单,而是涉及文档本身。 Here is what is located there. 这是那里的东西。

Private Sub Document_New()
    UserFormInfo.Show
    'ActiveDocument.Bookmarks("cursor").Select
    ActiveDocument.TrackRevisions = False
    ActiveDocument.Save
End Sub

I expect to have this turn off tracked changes, however, this does not occur. 我希望关闭跟踪的更改,但是不会发生。 Any help is appreciated. 任何帮助表示赞赏。

What ended up working for me is I had to remake my template. 最终对我有用的是我不得不重新制作模板。 I had to export my user form so that it was fully removed from all my word files and then remake the template, after that, I had no problem with tracked changes turning on when I ran my macro to open this template. 我必须导出用户表单,以便将其从我的所有Word文件中完全删除,然后重新制作模板,此后,我在运行宏以打开此模板时打开跟踪更改就没有问题。 I believe it was a setting I must have had turned on when I had made my template. 我相信这是我制作模板时必须打开的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用宏抑制/关闭 MS Word 中的特定警告? - How do I suppress/turn off a particular warning in MS Word using Macros? 如何关闭View | 阅读Outlook文件夹的窗格? - How do I turn off the View | Reading pane for Outlook folder? 如何在Excel 2007中关闭VBA中的自动更正? - How do I turn off autocorrect in VBA in Excel 2007? 如何使用 VBA/宏根据行内容将某些输入行转换为多个新行? - How do can I turn some rows of input into multiple new rows depending row contents with VBA/macros? 如何通过 VBA 以编程方式关闭 Microsoft Word 文档中的波浪形红线? - How do I programmatically turn off the wavy red lines in a Microsoft Word document via VBA? 如何标记Excel范围NoProofing? 或关闭范围的拼写检查? - How do I mark an Excel range NoProofing? or turn off spell checking for a range? 使用chart.chartstyle = 248时,如何关闭轴标题中的所有大写字母? - When utilizing chart.chartstyle = 248 how do I turn off all caps in the axes title? 如何在不使用 ActiveWindow 的情况下使用 VBA 关闭 excel 中的网格线 - How can I turn off gridlines in excel using VBA, without using ActiveWindow 如何将跟踪更改应用于文档的特定部分? - How to apply tracked changes to specific sections of a document? 如何即时禁用和启用宏? - How do I disable and enable macros on the fly?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM