ppt 宏遍历每个字符的颜色(红色加下划线,蓝色变斜体)
Sub ReplaceColor()
Dim shape As shape
Dim slide As slide
Dim txt As TextRange
On Error Resume Next
For Each slide In ActivePresentation.Slides
For Each shape In slide.Shapes
Set txt = shape.TextFrame.TextRange
For Each sentence In txt.Sentences
For Each word In sentence.Words
If word.Font.Color.RGB = RGB(60, 14, 254) Then '如果字符颜色=rgb(60,14,254)时
With word.Font
.Name = "新宋体"
.Size = 20
.Italic = True
.Bold = Not True
End With
End If
If word.Font.Color.RGB = RGB(255, 0, 0) Then
With word.Font
.Name = "Arial"
.Underline = True
.Bold = True
.Italic = Not True
End With
End If
Next
Next
Next
Next
End Sub
本文介绍了一个使用VBA宏来遍历PowerPoint演示文稿中每一页幻灯片上的文字,并根据文字颜色(蓝色变为斜体,红色加下划线)进行字体样式更改的方法。宏代码详细展示了如何针对不同颜色的文字应用特定的格式设置。
4203

被折叠的 条评论
为什么被折叠?



