ctrl+H打开替换对话框,单击高级,勾选使用通配符,在查找框中原样输入:第[一二三四五六七八九十]@章
在替换为框中输入:江湖篇^&
单击全部替换即可。熟悉word的通配符替换,可以实现很多你意向不到的功能。
第二个问题要采用VBA编程才能实现!
在工具=宏-宏...中,打开对话框,新建一个宏,创建,打开VBA编辑器,将里面的内容清空,然后将如下代码粘贴进去后按F5键运行即可。(只适用于<1000的情形下)
Sub MyReplace()
Selection.HomeKey
Selection.WholeStory
WholeText = Selection.Text
Debug.Print WholeText
WholeTextTmp = ""
Do Until WholeText = ""
MyChTmp = Left(WholeText, 1)
If InStr("一二三是五六七八九十百", MyChTmp) Then
MyCh = MyCh + MyChTmp
Else
If Len(MyCh) = 1 Then
Select Case MyCh
Case "一": MyCh = "001"
Case "二": MyCh = "002"
Case "三": MyCh = "003"
Case "四": MyCh = "004"
Case "五": MyCh = "005"
Case "六": MyCh = "006"
Case "七": MyCh = "007"
Case "八": MyCh = "008"
Case "九": MyCh = "009"
Case "十": MyCh = "010"
End Select
ElseIf Len(MyCh) = 2 Then
Select Case MyCh
Case "二十": MyCh = "020"
Case "三十": MyCh = "030"
Case "四十": MyCh = "040"
Case "五十": MyCh = "050"
Case "六十": MyCh = "060"
Case "七十": MyCh = "070"
Case "八十": MyCh = "080"
Case "九十": MyCh = "090"
Case "一百": MyCh = "100"
Case "十一": MyCh = "011"
Case "十二": MyCh = "012"
Case "十三": MyCh = "013"
Case "十四": MyCh = "014"
Case "十五": MyCh = "015"
Case "十六": MyCh = "016"
Case "十七": MyCh = "017"
Case "十八": MyCh = "018"
Case "十九": MyCh = "019"
End Select
ElseIf Len(MyCh) = 3 Then
Select Case Left(MyCh, 1)
Case "二": a = "2"
Case "三": a = "3"
Case "四": a = "4"
Case "五": a = "5"
Case "六": a = "6"
Case "七": a = "7"
Case "八": a = "8"
Case "九": a = "9"
End Select
Select Case Right(MyCh, 1)
Case "一": b = "1"
Case "二": b = "2"
Case "三": b = "3"
Case "四": b = "4"
Case "五": b = "5"
Case "六": b = "6"
Case "七": b = "7"
Case "八": b = "8"
Case "九": b = "9"
End Select
MyCh = "0" + a + b
ElseIf Len(MyCh) = 4 Then
Select Case Left(MyCh, 1)
Case "一": a = "1"
Case "二": a = "2"
Case "三": a = "3"
Case "四": a = "4"
Case "五": a = "5"
Case "六": a = "6"
Case "七": a = "7"
Case "八": a = "8"
Case "九": a = "9"
End Select
Select Case Right(MyCh, 1)
Case "一": b = "1"
Case "二": b = "2"
Case "三": b = "3"
Case "四": b = "4"
Case "五": b = "5"
Case "六": b = "6"
Case "七": b = "7"
Case "八": b = "8"
Case "九": b = "9"
End Select
MyCh = a + "0" + b
ElseIf Len(MyCh) = 5 Then
Select Case Left(MyCh, 1)
Case "一": a = "1"
Case "二": a = "2"
Case "三": a = "3"
Case "四": a = "4"
Case "五": a = "5"
Case "六": a = "6"
Case "七": a = "7"
Case "八": a = "8"
Case "九": a = "9"
End Select
Select Case Mid(MyCh, 3, 1)
Case "一": b = "1"
Case "二": b = "2"
Case "三": b = "3"
Case "四": b = "4"
Case "五": b = "5"
Case "六": b = "6"
Case "七": b = "7"
Case "八": b = "8"
Case "九": b = "9"
End Select
Select Case Right(MyCh, 1)
Case "一": c = "1"
Case "二": c = "2"
Case "三": c = "3"
Case "四": c = "4"
Case "五": c = "5"
Case "六": c = "6"
Case "七": c = "7"
Case "八": c = "8"
Case "九": c = "9"
End Select
MyCh = a + b + c
End If
WholeTextTmp = WholeTextTmp + MyCh + MyChTmp
MyCh = ""
End If
WholeText = Mid(WholeText, 2)
Loop
Selection.WholeStory
Selection.Text = WholeTextTmp
MsgBox "查找替换完毕!"
End Sub