Word VBA,选择整个文档减去第一页 [英] Word VBA, Select whole document minus first page

查看:65
本文介绍了Word VBA,选择整个文档减去第一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以像这样选择整个文档

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?

上下文:Excel 运行所有代码并将范围直接输出到 word 以构建报告.报告可以是任意页数,页数未知.此代码将作为最后一部分运行,因此此时将构建文档.

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.

推荐答案

以下代码选择从第二页开始的所有内容:

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

这篇关于Word VBA,选择整个文档减去第一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆