所以我们假设我们有一个只有1列的表。在每个单元格中,可以有许多句子的子弹(指针)如下:
我已经能够在子弹(段落对象)之间进行迭代并得到每个句子;
但我想知道的是......有没有办法强调之间的'特别是'或'反复'反馈':'已发生?
代码如下:
Dim objParagraph As Paragraph,rangeStart As Integer,rangeEnd As Integer
For Each.Range.Paragraphs中的每个objParagraph 如果objParagraph.Range.Text喜欢“Recurring *”那么
rangeStart = Len("Recurring feedback on ") +1
否则
rangeStart = Len("In particular to ") +1
结束如果
rangeEnd = Len(左(objParagraph.Range.Text, InStr函数(objParagraph.Range.Text, “:” - 1))
'格式范围(开始,结束).underlined = true?
下一个objParagraph
抱歉英文不好:/
答案 0 :(得分:0)
好,
我已经修改了一下,以下内容可以帮助你。
Dim ran As Range, rstart As Long, rend As Long
Set ran = ActiveDocument.Content
With ran
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "In particular to "
.Replacement.text = ""
.MatchWildcards = False
.MatchCase = False
.Wrap = wdFindStop
.Execute
End With
While .Find.Found
rstart = .End
.Collapse wdCollapseEnd
.Find.text = ":"
.Find.Execute
rend = .Start
ActiveDocument.Range(rstart, rend).Font.Underline = wdUnderlineSingle
.Collapse wdCollapseEnd
.Find.text = "In particular to "
.Find.Execute
Wend
.Find.text = "Recurring feedback on "
.Find.Execute
While .Find.Found
rstart = .End
.Collapse wdCollapseEnd
.Find.text = ":"
.Find.Execute
rend = .Start
ActiveDocument.Range(rstart, rend).Font.Underline = wdUnderlineSingle
.Collapse wdCollapseEnd
.Find.text = "Recurring feedback on "
.Find.Execute
Wend
End With
如果您希望将处理限制为表格,只需替换
Set ran = ActiveDocument.Content
与
Set ran = ActiveDocument.Tables(1).Range