ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: 13907933959

[求助] Word录制宏后,让宏对字体的颜色更改为蓝色、无法保存

[复制链接]

TA的精华主题

TA的得分主题

发表于 2015-6-7 08:35 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
楼主,宏3共33步,你试试吧!(结合《重新打开》宏,反复试验,不要存盘,自己做一份简单的 demo):
  1. Sub test()
  2. '中医----宏 3
  3.     Selection.HomeKey Unit:=wdStory
  4.     Do
  5.         Selection.Find.Execute FindText:=",^?^p"
  6.         Selection.Font.Color = wdColorRed
  7.     Loop Until Selection.Find.Found = False

  8.     Selection.HomeKey Unit:=wdStory
  9.     Do
  10.         Selection.Find.Execute FindText:=",^?^?^p"
  11.         Selection.Font.Color = wdColorRed
  12.     Loop Until Selection.Find.Found = False

  13.     Selection.HomeKey Unit:=wdStory
  14.     Do
  15.         Selection.Find.Execute FindText:=",^?^?^?^p"
  16.         Selection.Font.Color = wdColorRed
  17.     Loop Until Selection.Find.Found = False

  18.     Selection.HomeKey Unit:=wdStory
  19.     Do
  20.         Selection.Find.Execute FindText:="、^?^p"
  21.         Selection.Font.Color = wdColorRed
  22.     Loop Until Selection.Find.Found = False

  23.     Selection.HomeKey Unit:=wdStory
  24.     Do
  25.         Selection.Find.Execute FindText:="、^?^?^p"
  26.         Selection.Font.Color = wdColorRed
  27.     Loop Until Selection.Find.Found = False

  28.     Selection.HomeKey Unit:=wdStory
  29.     Do
  30.         Selection.Find.Execute FindText:="^p^?,"
  31.         Selection.Font.Color = wdColorRed
  32.     Loop Until Selection.Find.Found = False

  33.     Selection.HomeKey Unit:=wdStory
  34.     Do
  35.         Selection.Find.Execute FindText:="^p^?^?,"
  36.         Selection.Font.Color = wdColorRed
  37.     Loop Until Selection.Find.Found = False

  38.     Selection.HomeKey Unit:=wdStory
  39.     Do
  40.         Selection.Find.Execute FindText:="^p^?^?^?,"
  41.         Selection.Font.Color = wdColorRed
  42.     Loop Until Selection.Find.Found = False

  43.     Selection.HomeKey Unit:=wdStory
  44.     Do
  45.         Selection.Find.Execute FindText:="《^?^p"
  46.         Selection.Font.Color = wdColorRed
  47.     Loop Until Selection.Find.Found = False

  48.     Selection.HomeKey Unit:=wdStory
  49.     Do
  50.         Selection.Find.Execute FindText:="《^?^?^p"
  51.         Selection.Font.Color = wdColorRed
  52.     Loop Until Selection.Find.Found = False

  53.     Selection.HomeKey Unit:=wdStory
  54.     Do
  55.         Selection.Find.Execute FindText:="《^?^?^?^p"
  56.         Selection.Font.Color = wdColorRed
  57.     Loop Until Selection.Find.Found = False
  58. ''下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  59.     Selection.HomeKey Unit:=wdStory
  60.     Do
  61.         Selection.Find.Execute FindText:="“^?^p"
  62.         Selection.Font.Color = wdColorRed
  63.     Loop Until Selection.Find.Found = False
  64. '下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  65.     Selection.HomeKey Unit:=wdStory
  66.     Do
  67.         Selection.Find.Execute FindText:="“^?^?^p"
  68.         Selection.Font.Color = wdColorRed
  69.     Loop Until Selection.Find.Found = False

  70.     Selection.HomeKey Unit:=wdStory
  71.     Do
  72.         Selection.Find.Execute FindText:="^p^?》"
  73.         Selection.Font.Color = wdColorRed
  74.     Loop Until Selection.Find.Found = False

  75.     Selection.HomeKey Unit:=wdStory
  76.     Do
  77.         Selection.Find.Execute FindText:="^p^?^?》"
  78.         Selection.Font.Color = wdColorRed
  79.     Loop Until Selection.Find.Found = False

  80.     Selection.HomeKey Unit:=wdStory
  81.     Do
  82.         Selection.Find.Execute FindText:="^p^?^?^?》"
  83.         Selection.Font.Color = wdColorRed
  84.     Loop Until Selection.Find.Found = False

  85.     Selection.HomeKey Unit:=wdStory
  86.     Do
  87.         Selection.Find.Execute FindText:="》^?^p"
  88.         Selection.Font.Color = wdColorRed
  89.     Loop Until Selection.Find.Found = False

  90.     Selection.HomeKey Unit:=wdStory
  91.     Do
  92.         Selection.Find.Execute FindText:="》^?^?^p"
  93.         Selection.Font.Color = wdColorRed
  94.     Loop Until Selection.Find.Found = False

  95.     Selection.HomeKey Unit:=wdStory
  96.     Do
  97.         Selection.Find.Execute FindText:="^p^?。"
  98.         Selection.Font.Color = wdColorRed
  99.     Loop Until Selection.Find.Found = False

  100.     Selection.HomeKey Unit:=wdStory
  101.     Do
  102.         Selection.Find.Execute FindText:="^p^?^?。"
  103.         Selection.Font.Color = wdColorRed
  104.     Loop Until Selection.Find.Found = False

  105.     Selection.HomeKey Unit:=wdStory
  106.     Do
  107.         Selection.Find.Execute FindText:="(^p"
  108.         Selection.Font.Color = wdColorRed
  109.     Loop Until Selection.Find.Found = False

  110.     Selection.HomeKey Unit:=wdStory
  111.     Do
  112.         Selection.Find.Execute FindText:="(^?^p"
  113.         Selection.Font.Color = wdColorRed
  114.     Loop Until Selection.Find.Found = False

  115.     Selection.HomeKey Unit:=wdStory
  116.     Do
  117.         Selection.Find.Execute FindText:="(^?^?^p"
  118.         Selection.Font.Color = wdColorRed
  119.     Loop Until Selection.Find.Found = False

  120.     Selection.HomeKey Unit:=wdStory
  121.     Do
  122.         Selection.Find.Execute FindText:="^p^?^p"
  123.         Selection.Font.Color = wdColorRed
  124.     Loop Until Selection.Find.Found = False

  125.     Selection.HomeKey Unit:=wdStory
  126.     Do
  127.         Selection.Find.Execute FindText:="^p^?^?^p"
  128.         Selection.Font.Color = wdColorRed
  129.     Loop Until Selection.Find.Found = False

  130.     Selection.HomeKey Unit:=wdStory
  131.     Do
  132.         Selection.Find.Execute FindText:="^p?"
  133.         Selection.Font.Color = wdColorRed
  134.     Loop Until Selection.Find.Found = False

  135.     Selection.HomeKey Unit:=wdStory
  136.     Do
  137.         Selection.Find.Execute FindText:="^p^?)"
  138.         Selection.Font.Color = wdColorRed
  139.     Loop Until Selection.Find.Found = False

  140.     Selection.HomeKey Unit:=wdStory
  141.     Do
  142.         Selection.Find.Execute FindText:="^p^?^?)"
  143.         Selection.Font.Color = wdColorRed
  144.     Loop Until Selection.Find.Found = False

  145.     Selection.HomeKey Unit:=wdStory
  146.     Do
  147.         Selection.Find.Execute FindText:="^p^?^?^?)"
  148.         Selection.Font.Color = wdColorRed
  149.     Loop Until Selection.Find.Found = False

  150.     Selection.HomeKey Unit:=wdStory
  151.     Do
  152.         Selection.Find.Execute FindText:="^p^#."
  153.         Selection.Font.Color = wdColorRed
  154.     Loop Until Selection.Find.Found = False

  155. '查找绿色某词替换为无
  156.     With ActiveDocument.Content.Find
  157.         .Font.Color = wdColorGreen
  158.         .Execute FindText:="^p", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  159.     End With

  160. '查找绿色某词替换为无
  161.     With ActiveDocument.Content.Find
  162.         .Font.Color = wdColorGreen
  163.         .Execute FindText:=" .", ReplaceWith:="、", Format:=True, Replace:=wdReplaceAll
  164.     End With

  165. '查找绿色替换为黑色
  166.     With ActiveDocument.Content.Find
  167.         .Font.Color = wdColorGreen
  168.         .Replacement.Font.Color = wdColorBlack
  169.         .Execute FindText:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  170.     End With
  171. End Sub
复制代码

TA的精华主题

TA的得分主题

发表于 2015-6-7 08:40 | 显示全部楼层
注意:如果拷贝到VBA编辑器中,有的代码呈红色,其实就是:有两段代码,因为是中文左双引号,它变成了英文的了,不合语法,你手动把呈红色段落的第 3 行语句:Selection.Find.Execute FindText:="“^?^p",就是findtext:=等号后面第2个双引号,手动改为中文左双引号即可。——如果出现红色,会有两段要改;如果没有红色,运行即可。

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-6-7 11:00 | 显示全部楼层
本帖最后由 13907933959 于 2015-6-7 11:16 编辑
413191246se 发表于 2015-6-7 08:40
注意:如果拷贝到VBA编辑器中,有的代码呈红色,其实就是:有两段代码,因为是中文左双引号,它变成了英文 ...

前辈好!
真是太缴动了,你真是神人,你的技术真是蓝波湾让人仰慕,前辈、代码粘贴后没有出现红色,运行正常,就是后面3步你可能没注意到,你把查找的字及符号替换为了红色(应为绿色),导至后3步没有实现,还不能把断行连了起来,查找的汉字没有变回黑色。再一个我想加一步这个  :^?^?^?^?^P  不知可成否?

还有一个下面的这个问题,我知道是我的这些步骤 ,^?^?^P   ,^?^?^?^P导置的,能不能让33个步骤里面的查找^?的时候不包括蓝色的★和▲
★<篇名>果,上部▲内容:大枣 杀乌头,毒。★<目录>卷三\下经▲
★<篇名>菜,上部▲内容:冬葵子 黄芩为使。葱实,解藜芦毒。
★<篇名>米,上部▲内容:麻、麻子 畏牡蛎、白薇;恶茯苓。
★<篇名>米,中部▲内容:大豆及黄卷 恶五参、龙胆;得前胡、乌喙、杏仁

TA的精华主题

TA的得分主题

发表于 2015-6-7 11:58 | 显示全部楼层
楼主,是这样,我看代码中都错了!都是红色的了!我重新改成 绿色(Green)的了。——另外,这个五角星和三角形,在查找和替换代码中我觉得是无能为力,但有个简便办法:你点击:编辑菜单——全选——颜色:自动色,就可以了。以后专门对《篇名》和《目录》做处理,很简单的,段落循环即可,现在你不必管这些。你只管替换即可,宏3加入了你附加的一段,试试吧:(文件不要存盘,只是试验,结合《重新打开》按钮)
  1. Sub test()
  2. '中医----宏 3(查找变绿色)
  3.     Selection.HomeKey Unit:=wdStory
  4.     Do
  5.         Selection.Find.Execute FindText:=",^?^p"
  6.         Selection.Font.Color = wdColorGreen
  7.     Loop Until Selection.Find.Found = False

  8.     Selection.HomeKey Unit:=wdStory
  9.     Do
  10.         Selection.Find.Execute FindText:=",^?^?^p"
  11.         Selection.Font.Color = wdColorGreen
  12.     Loop Until Selection.Find.Found = False

  13.     Selection.HomeKey Unit:=wdStory
  14.     Do
  15.         Selection.Find.Execute FindText:=",^?^?^?^p"
  16.         Selection.Font.Color = wdColorGreen
  17.     Loop Until Selection.Find.Found = False

  18.     Selection.HomeKey Unit:=wdStory
  19.     Do
  20.         Selection.Find.Execute FindText:="、^?^p"
  21.         Selection.Font.Color = wdColorGreen
  22.     Loop Until Selection.Find.Found = False

  23.     Selection.HomeKey Unit:=wdStory
  24.     Do
  25.         Selection.Find.Execute FindText:="、^?^?^p"
  26.         Selection.Font.Color = wdColorGreen
  27.     Loop Until Selection.Find.Found = False

  28.     Selection.HomeKey Unit:=wdStory
  29.     Do
  30.         Selection.Find.Execute FindText:="^p^?,"
  31.         Selection.Font.Color = wdColorGreen
  32.     Loop Until Selection.Find.Found = False

  33.     Selection.HomeKey Unit:=wdStory
  34.     Do
  35.         Selection.Find.Execute FindText:="^p^?^?,"
  36.         Selection.Font.Color = wdColorGreen
  37.     Loop Until Selection.Find.Found = False

  38.     Selection.HomeKey Unit:=wdStory
  39.     Do
  40.         Selection.Find.Execute FindText:="^p^?^?^?,"
  41.         Selection.Font.Color = wdColorGreen
  42.     Loop Until Selection.Find.Found = False

  43.     Selection.HomeKey Unit:=wdStory
  44.     Do
  45.         Selection.Find.Execute FindText:="《^?^p"
  46.         Selection.Font.Color = wdColorGreen
  47.     Loop Until Selection.Find.Found = False

  48.     Selection.HomeKey Unit:=wdStory
  49.     Do
  50.         Selection.Find.Execute FindText:="《^?^?^p"
  51.         Selection.Font.Color = wdColorGreen
  52.     Loop Until Selection.Find.Found = False

  53.     Selection.HomeKey Unit:=wdStory
  54.     Do
  55.         Selection.Find.Execute FindText:="《^?^?^?^p"
  56.         Selection.Font.Color = wdColorGreen
  57.     Loop Until Selection.Find.Found = False
  58. '下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  59.     Selection.HomeKey Unit:=wdStory
  60.     Do
  61.         Selection.Find.Execute FindText:="“^?^p"
  62.         Selection.Font.Color = wdColorGreen
  63.     Loop Until Selection.Find.Found = False
  64. '下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  65.     Selection.HomeKey Unit:=wdStory
  66.     Do
  67.         Selection.Find.Execute FindText:="“^?^?^p"
  68.         Selection.Font.Color = wdColorGreen
  69.     Loop Until Selection.Find.Found = False

  70.     Selection.HomeKey Unit:=wdStory
  71.     Do
  72.         Selection.Find.Execute FindText:="^p^?》"
  73.         Selection.Font.Color = wdColorGreen
  74.     Loop Until Selection.Find.Found = False

  75.     Selection.HomeKey Unit:=wdStory
  76.     Do
  77.         Selection.Find.Execute FindText:="^p^?^?》"
  78.         Selection.Font.Color = wdColorGreen
  79.     Loop Until Selection.Find.Found = False

  80.     Selection.HomeKey Unit:=wdStory
  81.     Do
  82.         Selection.Find.Execute FindText:="^p^?^?^?》"
  83.         Selection.Font.Color = wdColorGreen
  84.     Loop Until Selection.Find.Found = False

  85.     Selection.HomeKey Unit:=wdStory
  86.     Do
  87.         Selection.Find.Execute FindText:="》^?^p"
  88.         Selection.Font.Color = wdColorGreen
  89.     Loop Until Selection.Find.Found = False

  90.     Selection.HomeKey Unit:=wdStory
  91.     Do
  92.         Selection.Find.Execute FindText:="》^?^?^p"
  93.         Selection.Font.Color = wdColorGreen
  94.     Loop Until Selection.Find.Found = False

  95.     Selection.HomeKey Unit:=wdStory
  96.     Do
  97.         Selection.Find.Execute FindText:="^p^?。"
  98.         Selection.Font.Color = wdColorGreen
  99.     Loop Until Selection.Find.Found = False

  100.     Selection.HomeKey Unit:=wdStory
  101.     Do
  102.         Selection.Find.Execute FindText:="^p^?^?。"
  103.         Selection.Font.Color = wdColorGreen
  104.     Loop Until Selection.Find.Found = False

  105.     Selection.HomeKey Unit:=wdStory
  106.     Do
  107.         Selection.Find.Execute FindText:="(^p"
  108.         Selection.Font.Color = wdColorGreen
  109.     Loop Until Selection.Find.Found = False

  110.     Selection.HomeKey Unit:=wdStory
  111.     Do
  112.         Selection.Find.Execute FindText:="(^?^p"
  113.         Selection.Font.Color = wdColorGreen
  114.     Loop Until Selection.Find.Found = False

  115.     Selection.HomeKey Unit:=wdStory
  116.     Do
  117.         Selection.Find.Execute FindText:="(^?^?^p"
  118.         Selection.Font.Color = wdColorGreen
  119.     Loop Until Selection.Find.Found = False

  120.     Selection.HomeKey Unit:=wdStory
  121.     Do
  122.         Selection.Find.Execute FindText:="^p^?^p"
  123.         Selection.Font.Color = wdColorGreen
  124.     Loop Until Selection.Find.Found = False

  125.     Selection.HomeKey Unit:=wdStory
  126.     Do
  127.         Selection.Find.Execute FindText:="^p^?^?^p"
  128.         Selection.Font.Color = wdColorGreen
  129.     Loop Until Selection.Find.Found = False

  130.     Selection.HomeKey Unit:=wdStory
  131.     Do
  132.         Selection.Find.Execute FindText:="^p?"
  133.         Selection.Font.Color = wdColorGreen
  134.     Loop Until Selection.Find.Found = False

  135.     Selection.HomeKey Unit:=wdStory
  136.     Do
  137.         Selection.Find.Execute FindText:="^p^?)"
  138.         Selection.Font.Color = wdColorGreen
  139.     Loop Until Selection.Find.Found = False

  140.     Selection.HomeKey Unit:=wdStory
  141.     Do
  142.         Selection.Find.Execute FindText:="^p^?^?)"
  143.         Selection.Font.Color = wdColorGreen
  144.     Loop Until Selection.Find.Found = False

  145.     Selection.HomeKey Unit:=wdStory
  146.     Do
  147.         Selection.Find.Execute FindText:="^p^?^?^?)"
  148.         Selection.Font.Color = wdColorGreen
  149.     Loop Until Selection.Find.Found = False

  150.     Selection.HomeKey Unit:=wdStory
  151.     Do
  152.         Selection.Find.Execute FindText:="^p^#."
  153.         Selection.Font.Color = wdColorGreen
  154.     Loop Until Selection.Find.Found = False

  155.     Selection.HomeKey Unit:=wdStory
  156.     Do
  157.         Selection.Find.Execute FindText:="^?^?^?^?^p"
  158.         Selection.Font.Color = wdColorGreen
  159.     Loop Until Selection.Find.Found = False

  160. '查找绿色某词替换为无
  161.     With ActiveDocument.Content.Find
  162.         .Font.Color = wdColorGreen
  163.         .Execute FindText:="^p", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  164.     End With

  165. '查找绿色某词替换为无
  166.     With ActiveDocument.Content.Find
  167.         .Font.Color = wdColorGreen
  168.         .Execute FindText:=" .", ReplaceWith:="、", Format:=True, Replace:=wdReplaceAll
  169.     End With

  170. '查找绿色替换为黑色
  171.     With ActiveDocument.Content.Find
  172.         .Font.Color = wdColorGreen
  173.         .Replacement.Font.Color = wdColorBlack
  174.         .Execute FindText:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  175.     End With
  176. End Sub
复制代码

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-6-7 12:48 | 显示全部楼层
413191246se 发表于 2015-6-7 11:58
楼主,是这样,我看代码中都错了!都是红色的了!我重新改成 绿色(Green)的了。——另外,这个五角星和三 ...

前辈好!
前辈、前辈救命呀!这个代码把文档中所的^p全部替掉了,整个文档成一块了。

TA的精华主题

TA的得分主题

发表于 2015-6-7 13:34 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
呵呵!楼主,这个我救不了你,上面代码倒数第三段,所有绿色^p(回车符)全部替换为""(无),你得自救!(好在,有原文件备份,啥也不怕,折腾吧!)

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-6-7 14:28 | 显示全部楼层
本帖最后由 13907933959 于 2015-6-7 17:23 编辑
413191246se 发表于 2015-6-7 13:34
呵呵!楼主,这个我救不了你,上面代码倒数第三段,所有绿色^p(回车符)全部替换为""(无),你得自救!( ...

前辈好!
可问题是它把黑色的^P都全部替掉了。
到数第3步我只是说把绿色的 ^p 替换为空,不是把所有的 ^p 都替换为空。
还有我叫你后加的一个步骤,你好象只加了 ^?^?^?^?^p 前面漏掉了一个引号 :^?^?^?^?^p

前辈呀!
是哪个漏加的引号,导至整篇文档变成了一块,我加了引号之后就正常了,断行也连上了70%。

前辈、还要再劳你,把下面的这十几个步骤加进代码中。(请加在代码倒数第2个'查找绿色某词替换为无,的前面)好让更多的断行能连上。


:^?^?^?^P 替换成绿色
:^?^?^P 替换成绿色
:^?^P 替换成绿色
;^?^P 替换成绿色
;^?^?^P 替换成绿色
;^?^?^?^P 替换成绿色
;^?^?^?^?^P 替换成绿色
,^?^?^?^?^P 替换成绿色
^P^?^?《替换成绿色
》^?^?^?^?^P 替换成绿色
。^?^P 替换成绿色
。^?^?^P 替换成绿色


前辈、下面这2个步骤是为了解决步分★▲这二行和正文连在一起的问题(请加在代码的最后面, 4个★,除了写有(蓝色的五角星)外,其它3个★不用设定颜色)。


查找^P★替换为★(蓝色的五角星)


查找★替换为^P★

TA的精华主题

TA的得分主题

发表于 2015-6-7 17:49 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
如果替换有误,可以放弃,不必存盘。另外,像如果把绿色^p替换为无,也可以替换为```,过后再替换回来。——不过我还是很佩服你的,这么多的替换步骤,怎么想的?我看着都乱。——依我原来的愚见,最简单的就是找到比如:从“内容:”---->>>到双回车符有空行这一段,替换掉所有的回车符,是最简单的做法。
稍等一下我添加一下代码。。。

TA的精华主题

TA的得分主题

发表于 2015-6-7 17:51 | 显示全部楼层
否则,放弃五角星和三角形?把全篇变为自动色,最后再处理它们两个,很简单的。

TA的精华主题

TA的得分主题

发表于 2015-6-7 19:07 | 显示全部楼层
  1. Sub test()
  2. '中医----宏 3(查找变绿色)
  3.     Selection.HomeKey Unit:=wdStory
  4.     Do
  5.         Selection.Find.Execute FindText:=",^?^p"
  6.         Selection.Font.Color = wdColorGreen
  7.     Loop Until Selection.Find.Found = False

  8.     Selection.HomeKey Unit:=wdStory
  9.     Do
  10.         Selection.Find.Execute FindText:=",^?^?^p"
  11.         Selection.Font.Color = wdColorGreen
  12.     Loop Until Selection.Find.Found = False

  13.     Selection.HomeKey Unit:=wdStory
  14.     Do
  15.         Selection.Find.Execute FindText:=",^?^?^?^p"
  16.         Selection.Font.Color = wdColorGreen
  17.     Loop Until Selection.Find.Found = False

  18.     Selection.HomeKey Unit:=wdStory
  19.     Do
  20.         Selection.Find.Execute FindText:="、^?^p"
  21.         Selection.Font.Color = wdColorGreen
  22.     Loop Until Selection.Find.Found = False

  23.     Selection.HomeKey Unit:=wdStory
  24.     Do
  25.         Selection.Find.Execute FindText:="、^?^?^p"
  26.         Selection.Font.Color = wdColorGreen
  27.     Loop Until Selection.Find.Found = False

  28.     Selection.HomeKey Unit:=wdStory
  29.     Do
  30.         Selection.Find.Execute FindText:="^p^?,"
  31.         Selection.Font.Color = wdColorGreen
  32.     Loop Until Selection.Find.Found = False

  33.     Selection.HomeKey Unit:=wdStory
  34.     Do
  35.         Selection.Find.Execute FindText:="^p^?^?,"
  36.         Selection.Font.Color = wdColorGreen
  37.     Loop Until Selection.Find.Found = False

  38.     Selection.HomeKey Unit:=wdStory
  39.     Do
  40.         Selection.Find.Execute FindText:="^p^?^?^?,"
  41.         Selection.Font.Color = wdColorGreen
  42.     Loop Until Selection.Find.Found = False

  43.     Selection.HomeKey Unit:=wdStory
  44.     Do
  45.         Selection.Find.Execute FindText:="《^?^p"
  46.         Selection.Font.Color = wdColorGreen
  47.     Loop Until Selection.Find.Found = False

  48.     Selection.HomeKey Unit:=wdStory
  49.     Do
  50.         Selection.Find.Execute FindText:="《^?^?^p"
  51.         Selection.Font.Color = wdColorGreen
  52.     Loop Until Selection.Find.Found = False

  53.     Selection.HomeKey Unit:=wdStory
  54.     Do
  55.         Selection.Find.Execute FindText:="《^?^?^?^p"
  56.         Selection.Font.Color = wdColorGreen
  57.     Loop Until Selection.Find.Found = False
  58. '下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  59.     Selection.HomeKey Unit:=wdStory
  60.     Do
  61.         Selection.Find.Execute FindText:="“^?^p"
  62.         Selection.Font.Color = wdColorGreen
  63.     Loop Until Selection.Find.Found = False
  64. '下面一段代码中,若出现红色,则将 findtext:=后面第二个双引号改为中文左双引号,自己键入吧!
  65.     Selection.HomeKey Unit:=wdStory
  66.     Do
  67.         Selection.Find.Execute FindText:="“^?^?^p"
  68.         Selection.Font.Color = wdColorGreen
  69.     Loop Until Selection.Find.Found = False

  70.     Selection.HomeKey Unit:=wdStory
  71.     Do
  72.         Selection.Find.Execute FindText:="^p^?》"
  73.         Selection.Font.Color = wdColorGreen
  74.     Loop Until Selection.Find.Found = False

  75.     Selection.HomeKey Unit:=wdStory
  76.     Do
  77.         Selection.Find.Execute FindText:="^p^?^?》"
  78.         Selection.Font.Color = wdColorGreen
  79.     Loop Until Selection.Find.Found = False

  80.     Selection.HomeKey Unit:=wdStory
  81.     Do
  82.         Selection.Find.Execute FindText:="^p^?^?^?》"
  83.         Selection.Font.Color = wdColorGreen
  84.     Loop Until Selection.Find.Found = False

  85.     Selection.HomeKey Unit:=wdStory
  86.     Do
  87.         Selection.Find.Execute FindText:="》^?^p"
  88.         Selection.Font.Color = wdColorGreen
  89.     Loop Until Selection.Find.Found = False

  90.     Selection.HomeKey Unit:=wdStory
  91.     Do
  92.         Selection.Find.Execute FindText:="》^?^?^p"
  93.         Selection.Font.Color = wdColorGreen
  94.     Loop Until Selection.Find.Found = False

  95.     Selection.HomeKey Unit:=wdStory
  96.     Do
  97.         Selection.Find.Execute FindText:="^p^?。"
  98.         Selection.Font.Color = wdColorGreen
  99.     Loop Until Selection.Find.Found = False

  100.     Selection.HomeKey Unit:=wdStory
  101.     Do
  102.         Selection.Find.Execute FindText:="^p^?^?。"
  103.         Selection.Font.Color = wdColorGreen
  104.     Loop Until Selection.Find.Found = False

  105.     Selection.HomeKey Unit:=wdStory
  106.     Do
  107.         Selection.Find.Execute FindText:="(^p"
  108.         Selection.Font.Color = wdColorGreen
  109.     Loop Until Selection.Find.Found = False

  110.     Selection.HomeKey Unit:=wdStory
  111.     Do
  112.         Selection.Find.Execute FindText:="(^?^p"
  113.         Selection.Font.Color = wdColorGreen
  114.     Loop Until Selection.Find.Found = False

  115.     Selection.HomeKey Unit:=wdStory
  116.     Do
  117.         Selection.Find.Execute FindText:="(^?^?^p"
  118.         Selection.Font.Color = wdColorGreen
  119.     Loop Until Selection.Find.Found = False

  120.     Selection.HomeKey Unit:=wdStory
  121.     Do
  122.         Selection.Find.Execute FindText:="^p^?^p"
  123.         Selection.Font.Color = wdColorGreen
  124.     Loop Until Selection.Find.Found = False

  125.     Selection.HomeKey Unit:=wdStory
  126.     Do
  127.         Selection.Find.Execute FindText:="^p^?^?^p"
  128.         Selection.Font.Color = wdColorGreen
  129.     Loop Until Selection.Find.Found = False

  130.     Selection.HomeKey Unit:=wdStory
  131.     Do
  132.         Selection.Find.Execute FindText:="^p?"
  133.         Selection.Font.Color = wdColorGreen
  134.     Loop Until Selection.Find.Found = False

  135.     Selection.HomeKey Unit:=wdStory
  136.     Do
  137.         Selection.Find.Execute FindText:="^p^?)"
  138.         Selection.Font.Color = wdColorGreen
  139.     Loop Until Selection.Find.Found = False

  140.     Selection.HomeKey Unit:=wdStory
  141.     Do
  142.         Selection.Find.Execute FindText:="^p^?^?)"
  143.         Selection.Font.Color = wdColorGreen
  144.     Loop Until Selection.Find.Found = False

  145.     Selection.HomeKey Unit:=wdStory
  146.     Do
  147.         Selection.Find.Execute FindText:="^p^?^?^?)"
  148.         Selection.Font.Color = wdColorGreen
  149.     Loop Until Selection.Find.Found = False

  150.     Selection.HomeKey Unit:=wdStory
  151.     Do
  152.         Selection.Find.Execute FindText:="^p^#."
  153.         Selection.Font.Color = wdColorGreen
  154.     Loop Until Selection.Find.Found = False

  155.     Selection.HomeKey Unit:=wdStory
  156.     Do
  157.         Selection.Find.Execute FindText:="^?^?^?^?^p"
  158.         Selection.Font.Color = wdColorGreen
  159.     Loop Until Selection.Find.Found = False

  160. '查找绿色某词替换为无
  161.     With ActiveDocument.Content.Find
  162.         .Font.Color = wdColorGreen
  163.         .Execute FindText:="^p", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  164.     End With

  165. '查找绿色某词替换为无
  166.     With ActiveDocument.Content.Find
  167.         .Font.Color = wdColorGreen
  168.         .Execute FindText:=" .", ReplaceWith:="、", Format:=True, Replace:=wdReplaceAll
  169.     End With

  170. ''''后加的一批!

  171.     Selection.HomeKey Unit:=wdStory
  172.     Do
  173.         Selection.Find.Execute FindText:=":^?^?^?^p"
  174.         Selection.Font.Color = wdColorGreen
  175.     Loop Until Selection.Find.Found = False

  176.     Selection.HomeKey Unit:=wdStory
  177.     Do
  178.         Selection.Find.Execute FindText:=":^?^?^p"
  179.         Selection.Font.Color = wdColorGreen
  180.     Loop Until Selection.Find.Found = False

  181.     Selection.HomeKey Unit:=wdStory
  182.     Do
  183.         Selection.Find.Execute FindText:=":^?^p"
  184.         Selection.Font.Color = wdColorGreen
  185.     Loop Until Selection.Find.Found = False

  186.     Selection.HomeKey Unit:=wdStory
  187.     Do
  188.         Selection.Find.Execute FindText:=";^?^p"
  189.         Selection.Font.Color = wdColorGreen
  190.     Loop Until Selection.Find.Found = False

  191.     Selection.HomeKey Unit:=wdStory
  192.     Do
  193.         Selection.Find.Execute FindText:=";^?^?^p"
  194.         Selection.Font.Color = wdColorGreen
  195.     Loop Until Selection.Find.Found = False

  196.     Selection.HomeKey Unit:=wdStory
  197.     Do
  198.         Selection.Find.Execute FindText:=";^?^?^?^p"
  199.         Selection.Font.Color = wdColorGreen
  200.     Loop Until Selection.Find.Found = False

  201.     Selection.HomeKey Unit:=wdStory
  202.     Do
  203.         Selection.Find.Execute FindText:=";^?^?^?^?^p"
  204.         Selection.Font.Color = wdColorGreen
  205.     Loop Until Selection.Find.Found = False

  206.     Selection.HomeKey Unit:=wdStory
  207.     Do
  208.         Selection.Find.Execute FindText:=",^?^?^?^?^p"
  209.         Selection.Font.Color = wdColorGreen
  210.     Loop Until Selection.Find.Found = False

  211.     Selection.HomeKey Unit:=wdStory
  212.     Do
  213.         Selection.Find.Execute FindText:="^p^?^?《"
  214.         Selection.Font.Color = wdColorGreen
  215.     Loop Until Selection.Find.Found = False

  216.     Selection.HomeKey Unit:=wdStory
  217.     Do
  218.         Selection.Find.Execute FindText:="》^?^?^?^?^p"
  219.         Selection.Font.Color = wdColorGreen
  220.     Loop Until Selection.Find.Found = False

  221.     Selection.HomeKey Unit:=wdStory
  222.     Do
  223.         Selection.Find.Execute FindText:="。^?^p"
  224.         Selection.Font.Color = wdColorGreen
  225.     Loop Until Selection.Find.Found = False

  226.     Selection.HomeKey Unit:=wdStory
  227.     Do
  228.         Selection.Find.Execute FindText:="。^?^?^p"
  229.         Selection.Font.Color = wdColorGreen
  230.     Loop Until Selection.Find.Found = False

  231. ''''查找绿色替换为黑色
  232.     With ActiveDocument.Content.Find
  233.         .Font.Color = wdColorGreen
  234.         .Replacement.Font.Color = wdColorBlack
  235.         .Execute FindText:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
  236.     End With

  237. '''最后两个五角星和三角形的替换
  238.     With ActiveDocument.Content.Find
  239.         .Replacement.Font.Color = wdColorBlue
  240.         .Execute FindText:="^p★", ReplaceWith:="★", Format:=True, Replace:=wdReplaceAll
  241.     End With

  242.     ActiveDocument.Content.Find.Execute FindText:="★", ReplaceWith:="^p★", Replace:=wdReplaceAll
  243. End Sub
复制代码
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2025-1-16 02:38 , Processed in 0.028166 second(s), 6 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表