接受Word页眉,页脚和主文档中的格式更改

时间:2015-10-29 09:23:09

标签: vba ms-word word-vba

我使用以下VBA代码接受文档中的所有格式更改。我还需要添加哪一行才能接受页眉和页脚中的更改?

ActiveDocument.ShowRevisions = True
ActiveDocument.ActiveWindow.View.ShowFormatChanges = True
ActiveDocument.ActiveWindow.View.ShowComments = False
ActiveDocument.ActiveWindow.View.ShowInsertionsAndDeletions = False
ActiveDocument.ActiveWindow.View.ShowInkAnnotations = False
ActiveDocument.AcceptAllRevisionsShown
ActiveDocument.ActiveWindow.View.ShowComments = True
ActiveDocument.ActiveWindow.View.ShowInsertionsAndDeletions = True
ActiveDocument.ActiveWindow.View.ShowFormatChanges = True
ActiveDocument.ActiveWindow.View.ShowInkAnnotations = True

1 个答案:

答案 0 :(得分:1)

选项1:

适用于所有HeadersFooters以及Main Document

 ActiveDocument.AcceptAllRevisions

选项2

这只会Accept Document当前可见区域中的 ActiveDocument.Revisions.AcceptAll 修订版。:

'Opening the Header
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

之前你可以添加的东西是:

wdSeek

如果您想查看特定的修订版,只需浏览各种Do选项即可浏览各个部分。

您还可以使用ForLoop ActiveDocument.Revisions.Item(x)在每个版本上运行脚本:

casper.then(function (){ this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[1]")); this.echo('Click 1'); this.sendKeys(x(".//*[@id='group-tab']/div[3]/div/div/div[1]"), 'dj'); this.echo('typing'); this.wait(3000); this.click(x(".//*[@id='group-tab']/div[3]/div/div/div[2]/div/div"), 'djoky', {keepFocus: true}); this.echo('Click from the list'); this.wait(4000); });