|
本帖最后由 sqhsqhli 于 2012-4-19 16:39 编辑
Sub text()
Dim s As String, a As String
With ActiveDocument.Content.Find
.Text = "[0-9]@."
.Forward = True
.MatchWildcards = True
Do While .Execute
.Parent.Font.Underline = wdUnderlineSingle
Loop
End With
With ActiveDocument.Content.Find
.Font.Underline = wdUnderlineSingle
Do While .Execute(FindText:="", Format:=True)
If Val(.Parent) <> 0 And InStr(.Parent, ".") <> 0 Then a = Chr(13) & .Parent Else a = .Parent & " "
s = s & a
Loop
End With
With ActiveDocument.Content.Find
.Text = "[0-9]@."
.Forward = True
.MatchWildcards = True
Do While .Execute
.Parent.Font.Underline = wdUnderlineNone
Loop
End With
With ActiveDocument.Content.Find
.Font.Underline = wdUnderlineSingle
.Execute FindText:="", ReplaceWith:=Space(9), Format:=True, Replace:=wdReplaceAll, Forward:=False'此处有个bug,替换成9个空格。当下划线文字位于边缘时会失去下划线显示
End With
ActiveDocument.Range.InsertAfter s
End Sub
|
|