|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 413191246se 于 2018-2-15 12:03 编辑
请楼主将附件中“分割线”一段及以后文字删除后测试,以下代码为 duquancai(杜先生)原创,本人略改:- Sub 完形填空_红色下划线单词转序号后加括号()
- 'code by duquancai原创,413191246se略改
- On Error Resume Next
- Dim n&, L&
- With ActiveDocument.Content.Find
- .Font.ColorIndex = wdRed
- Do While .Execute("[!^32]{1,}", , , 1)
- n = n + 1
- With .Parent
- L = (Len(.Text) - Len(n)) \ 2
- .Text = Space(3) & n & Space(3) & "( )"
- .Select
- Selection.MoveStart unit:=wdCharacter, Count:=Len(Selection) - 8
- Selection.Font.Underline = wdUnderlineNone
- .Collapse 0
- End With
- Loop
- End With
- End Sub
复制代码
|
|