|
需要使用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
复制代码 搜索自网络 秋,怡然若晴。的博文
|
|