我在 MS Word Visual Basic 编辑器中有这个 VBA 代码;
它旨在重置页码,以便它们连续工作。但是,它似乎跳过了循环的全部内容而不执行它。
Sub Macro3()
'
' Macro3 Macro
' Test 3
'
Dim GetNumberOfPages
For IncVar = 1 To GetNumberOfPages
WordBasic.ViewFooterOnly
ActiveDocument.AttachedTemplate.BuildingBlockEntries(" Blank").Insert _
Where:=Selection.Range, RichText:=True
WordBasic.ViewFooterOnly
ActiveDocument.AttachedTemplate.BuildingBlockEntries("Plain Number 3"). _
Insert Where:=Selection.Range, RichText:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.WholeStory
With Selection.Sections(IncVar).Headers(IncVar).PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = False
.StartingNumber = 0
End With
Selection.WholeStory
Selection.EscapeKey
ActiveWindow.ActivePane.View.ShowAll = Not ActiveWindow.ActivePane.View. _
ShowAll
Selection.EscapeKey
Selection.EscapeKey
Next IncVar
End Sub
为什么是这样?我该如何解决?
谢谢,
巴里·史密斯