Microsoft Word VBA 脚本接受所有删除吗? [英] Microsoft Word VBA script to accept all deletions?
本文介绍了Microsoft Word VBA 脚本接受所有删除吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Word 2010 中进行了大量修订(多位作者打开了跟踪更改).我想创建一种方法来接受文档中的所有删除而不接受插入.我做了一些研究,发现了一个声称这样做的 VBA 脚本示例,但它只是给了我一条错误消息.几周前,我找不到脚本或记住错误消息.
I work with a lot of revisions in Word 2010 (multiple authors with track changes on). I'd like to create a way to accept all deletions in a document without accepting the insertions. I did some research and found a VBA script example that claimed to do this but it just gave me an error message. It was a couple weeks ago and I can't find the script or remember the error message.
有人知道怎么做吗?提前致谢.
Anyone know how to do this? Thanks in advance.
找到了我正在使用的代码,出于某种原因,它现在可以工作了.
Found the code I was using and for some reason it's working now.
Sub AcceptDeletion()
Dim oChange As Revision
For Each oChange In ActiveDocument.Revisions
With oChange
If .Type = wdRevisionDelete Then
.Accept
End If
End With
Next oChange
End Sub
推荐答案
你可以更整洁:
With oChange
If .Type = wdRevisionDelete Then
.Accept
End If
End With
你应该说:
If oChange.Type = wdRevisionDelete Then oChange.Accept
这篇关于Microsoft Word VBA 脚本接受所有删除吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文