Function go1(p1, l1)
Selection.GoTo wdGoToPage, , p1
' Selection.GoTo wdGoToLine, , l1 '不能用,因会跳到第一页
Selection.MoveDown unit:=wdLine, Count:=l1
End Function
Function select_cp1(p1, l1, p2, l2)
go1 p1, l1
a1 = Selection.Paragraphs(1).Range.Start
go1 p2, l2
a2 = Selection.Paragraphs(1).Range.End
ActiveDocument.Range(a1, a2).Select
'---
Selection.Copy
End Function
Function word1()
word1 = Split(Selection.Paragraphs(1).Range.Text, Chr(13))(0)
End Function
Function judge_title1()
a1 = word1
judge_title1 = False
If a1 <> "" Then
If InStr(a1, "t_") = 1 Or InStr(a1, "_t_") = 1 Or InStr(a1, "@") = 1 Then
judge_title1 = True
End If
End If
End Function
Function move1(Optional up = 1, Optional count = 1, Optional ex = 0)
If up = 1 Then
Selection.MoveUp unit:=wdLine, count:=count
Else
Selection.MoveDown unit:=wdLine, count:=count
End If
End Function
Sub cp_tab1()
p0 = Selection.Information(wdActiveEndAdjustedPageNumber)
l0 = Selection.Information(wdFirstCharacterLineNumber)
For i = 0 To 1000
a1 = word1
If judge_title1 = True Then
p1 = Selection.Information(wdActiveEndAdjustedPageNumber)
l1 = Selection.Information(wdFirstCharacterLineNumber)
Exit For
Else
move1
End If
Next
go1 p0, l0
For i = 0 To 1000
If judge_title1 = True Then
p2 = Selection.Information(wdActiveEndAdjustedPageNumber)
l2 = Selection.Information(wdFirstCharacterLineNumber) - 1
Exit For
Else
move1 0
End If
Next
'---
select_cp1 p1, l1, p2, l2
End Sub