|
。。。。。。。。。。。。。。。。。
- Sub the_Test()
- Dim theSpeciefiedPageNum&, theSpeciefiedPageStart&, theSpeciefiedPageEnd&
- Dim theCharactersCount&, theSpeciefiedCharactersStart&, theSpeciefiedCharactersEnd&
- Dim theCharacterStart&, theCharacterEnd&, theSpeciefiedParagraphNum&
- Dim theSpeciefiedPageParagraphsCount&, theDocumentPagesCount&
- '
- theSpeciefiedPageNum = 2 '指定的页码
- theSpeciefiedParagraphNum = 3 '指定所在页的段落数
- theSpeciefiedCharactersStart = 10 '指定的字符串起始字符数
- theSpeciefiedCharactersEnd = 14 '指定的字符串终止字符数
- theDocumentPagesCount = ActiveDocument.Range.Information(1)
- With ActiveDocument
- With .Content
- theSpeciefiedPageStart = .GoTo(1, 1, theSpeciefiedPageNum).Start
- If theSpeciefiedPageNum + 1 < theDocumentPagesCount Then
- theSpeciefiedPageEnd = .GoTo(1, 1, theSpeciefiedPageNum + 1).Start
- Else
- theSpeciefiedPageEnd = .End
- End If
- End With
- With .Range(theSpeciefiedPageStart, theSpeciefiedPageEnd)
- theSpeciefiedPageParagraphsCount = .Paragraphs.Count
- If theSpeciefiedParagraphNum <= theSpeciefiedPageParagraphsCount Then
- With .Paragraphs(theSpeciefiedParagraphNum).Range
- theCharactersCount = .Characters.Count
- If theSpeciefiedCharactersEnd <= theCharactersCount Then
- theCharacterStart = .Characters(theSpeciefiedCharactersStart).Start
- theCharacterEnd = .Characters(theSpeciefiedCharactersEnd).End
- ActiveDocument.Range(theCharacterStart, theCharacterEnd).Select
- End If
- End With
- End If
- End With
- End With
- End Sub
复制代码
|
|