使用word怎么批量修改txt小说章节名称?

2024-12-04 16:56:31
推荐回答(4个)
回答1:

  1. ctrl+H打开替换对话框,单击高级,勾选使用通配符,在查找框中原样输入:第[一二三四五六七八九十]@章 

  2. 在替换为框中输入:究极武装^& 

  3. 单击全部替换即可。熟悉word的通配符替换,可以实现很多你意向不到的功能。 

  4. 第二个问题要采用VBA编程才能实现!  

  5. 在工具=宏-宏...中,打开对话框,新建一个宏,创建,打开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

回答2:

  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

回答3:

用 word 打开这个文本文件

ctrl+h 打开替换窗口 查找里 填写 章。 替换里 输入 第^&章 这样全部替换 一次……
然后再在查找里 输入 第章 替换里输入 第 全部替换……
这样两次替换 基本上就可以了……一般来说 小说 正文中 不会涉及到 类似:“章一”、“第章” 这样的文字的 但是 如果 你的正文中 也有类似 章X 这样的词的话 似乎也要被替换了……
所以 更准确的处理方法 要知道 你的文本的排列方式……
用word 打开 是什么样子的 贴图上来比较好……如果在word 中有不同的格式的话,附加上格式会比较好些

回答4:

强烈推荐word文档批量处理大师,该软件最新版增加了批量运行vba宏代码的功能,有了该功能,所有使用者都可以自己定制适合自己的功能了。只要把可以实现该功能的代码(从网上搜集到的或者是好心人提供的正确代码)粘贴到软件中,就可以批量处理海量的word文档了!超级梦幻工具