问题
I know you can select the whole document like so
oWord.oDoc.ActiveWindow.Selection.WholeStory
What would be the syntax to select the whole document minus the first page?
Context: Excel runs all the code and outputs ranges direct to word to build a report. Reports can be any number of pages and the amount of pages is not known. This code would run as the last piece so document would be built by this point.
回答1:
The following code selects everything from the second page onward:
Dim startRan As Range
Selection.HomeKey unit:=wdStory
Set startRan = Selection.GoTo(What:=wdGoToBookmark, Name:="\page")
oDoc.Range(startRan.End, startRan.End).Select
Selection.EndKey unit:=wdStory, Extend:=wdExtend
来源:https://stackoverflow.com/questions/31697918/word-vba-select-whole-document-minus-first-page