zoukankan      html  css  js  c++  java
  • 根据答案颜色提取答案

    Sub 根据红色整理选择题答案()
        N = 0
        Selection.HomeKey Unit:=wdStory
        Selection.Find.ClearFormatting
        Selection.Find.Font.Color = wdColorRed
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = ""
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchByte = True
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            Do While .Execute
            N = N + 1
            s = s & "   " & N & "、" & RegGet(.Parent.Text, "(w)")
            Loop
        End With
        Debug.Print s
    End Sub
    Public Function RegGet(ByVal OrgText As String, ByVal Pattern As String) As String
        Dim Regex As Object
        Dim Mh As Object
        Set Regex = CreateObject("VBScript.RegExp")
        With Regex
            .Global = True
            .Pattern = Pattern
        End With
        If Regex.test(OrgText) Then
            Set Mh = Regex.Execute(OrgText)
            RegGet = Mh.Item(0).submatches(0)
        Else
            RegGet = ""
        End If
        Set Regex = Nothing
    End Function
    

      

  • 相关阅读:
    BZOJ1006: [HNOI2008]神奇的国度
    弦图与区间图
    后缀自动机
    插头DP
    BZOJ3328: PYXFIB
    BZOJ2118: 墨墨的等式
    BZOJ3916: [Baltic2014]friends
    BZOJ1337: 最小圆覆盖
    BZOJ3784: 树上的路径
    代码模版
  • 原文地址:https://www.cnblogs.com/nextseven/p/11003743.html
Copyright © 2011-2022 走看看