vba判断word文字颜色是否为蓝色
时间:2023-12-13 10:21:52
①第一种代码
On Error GoTo ErrHandle
Set myRange = ActiveDocument.Range(Selection.Start, ActiveDocument.Content.End)
For Each iChar In myRange.Characters
Selection.MoveRight Unit:=wdCharacter, Count:=1
If Selection.Font.ColorIndex = 2 Then MsgBox iChar
Next
Exit Sub
ErrHandle:
MsgBox "Error number: " + Str$(Err) + Chr(13) + Error$(Err), 48, m_Title
②第二种代码
Dim n As Integer, Info As String
With Selection.Find
.Parent.HomeKey wdStory
.ClearFormatting
.Font.Color = wdColorBlue
Do While .Execute
n = n + 1
Info = Info & n & vbTab & .Parent & vbCrLf '提取找到的文本
.Parent.Delete '删除找到的文本(蓝色字体)
Loop
End With
If Info = "" Then MsgBox "未找到指定颜色字体" Else Documents.Add.Content = Info
标签:vba判断word文字颜色是否为蓝色
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win11关机后外设还亮是怎么回事 Win11关机后外设还亮解决方法
2022-11-06 12:40:29
![](https://img.aspxhome.com/file/2023/27/a236107_0s.jpg)
e-s0bic1.exe进程是什么文件的 e-s0bic1进程有什么作用
2022-09-22 07:43:18
WPS word中批量字母大小写快速切换的方法
2023-02-03 23:38:29
![](https://img.aspxhome.com/file/2023/9/a186159_0s.png)
切记!恶意软件侵扰电脑的种种迹象
2022-11-29 10:45:54
Scrivener for Mac如何自定义快捷键
2023-04-29 10:06:35
Win10系统电脑出现nvlddmkm.sys错误的解决办法
2023-07-15 01:35:36
M2 款 MacBook Pro 13 评测:GPU 性能提升最大
2022-11-21 19:18:38
![](https://img.aspxhome.com/file/2023/9/a202609_0s.jpeg)
惠普 战X 13 锐龙版笔记本重装win10系统教程
2022-02-21 20:38:20
![](https://img.aspxhome.com/file/2023/30/a267914_0s.png)
Ulysses 22: 继续进化,支持更新已发布博文,D22更大尺寸标题
2023-04-01 06:52:16
![](https://img.aspxhome.com/file/2023/2/a207802_0s.jpeg)
WORD表格,要制作一个小方框里打钩怎么做呢?
2023-11-30 03:08:45
![](https://img.aspxhome.com/file/2023/1/18981_0s.jpg)
Windows10如何关闭文件资源管理器搜索记录?
2022-11-12 06:12:29
![](https://img.aspxhome.com/file/2023/26/a223132_0s.png)
Win7软件卸载不了怎么办?
2023-01-08 12:50:26
![](https://img.aspxhome.com/file/2023/27/a232769_0s.jpg)
如何查看MacBook的型号?
2023-12-09 15:13:41
![](https://img.aspxhome.com/file/2023/9/a202979_0s.jpeg)
wps软件如何关闭所有打开的文件
2023-08-17 10:48:23
![](https://img.aspxhome.com/file/2023/0/a182650_0s.png)
word中怎样改变字符间距
2023-06-04 16:22:29
Win11亮度被锁定怎么解除?Win11屏幕亮度被锁定的解决方法
2022-08-21 11:39:36
![](https://img.aspxhome.com/file/2023/30/a265574_0s.jpg)
电脑版wps文档如何设置题注在图片的上方
2023-01-16 01:47:35
![](https://img.aspxhome.com/file/2023/2/a182922_0s.png)
AirPods无线充电盒和有线充电有什么区别?
2023-02-06 01:07:46
![](https://img.aspxhome.com/file/2023/6/a197916_0s.jpg)
你的PPT排版为什么那么差劲,学完这招将满分!
2022-06-15 09:35:57
![](https://img.aspxhome.com/file/2023/10/a351982_0s.jpg)
ios14苹果信号怎么改成圆点_ios14苹果信号改成圆点教程
2022-06-24 19:45:48
![](https://img.aspxhome.com/file/2023/3/a301674_0s.jpg)