vbscript 单词select_and_cp

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript 单词select_and_cp相关的知识,希望对你有一定的参考价值。

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

以上是关于vbscript 单词select_and_cp的主要内容,如果未能解决你的问题,请参考以下文章

vbscript 单个单词查缩写

vbscript 单词get_title11

vbscript 单词提取

vbscript 单词add_link

vbscript excel从单词中获取形式

“vbscript”查找行有相似的单词用冒号分隔“:”[关闭]