Office中国论坛/Access中国论坛
标题:
【源码】Access VBA批量替换PPT中的文字的字体颜色
[打印本页]
作者:
tmtony
时间:
2015-7-10 10:04
标题:
【源码】Access VBA批量替换PPT中的文字的字体颜色
需要使用Access用VBA批量替换PPT各幻灯片中形体中的文字的字体颜色,可使用以下代码
Sub ReplaceColor()
Dim shape As shape
Dim slide As slide
Dim txt As TextRange
On Error Resume Next
'替换背景颜色为白色
ActivePresentation.SlideMaster.Background.Fill.Solid
ActivePresentation.SlideMaster.Background.Fill.ForeColor.RGB = RGB(255, 255, 255)
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(0, 0, 204) Or word.Font.color.RGB = RGB(0, 0, 122) Then
With word.Font
.color.RGB = RGB(40, 40, 40)
End With
End If
Next
Next
Next
Next
End Sub
复制代码
搜索自网络 秋,怡然若晴。的博文
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3