设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2501|回复: 0
打印 上一主题 下一主题

[与其它组件] 【源码】Access VBA批量替换PPT中的文字的字体颜色

[复制链接]

点击这里给我发消息

跳转到指定楼层
1#
发表于 2015-7-10 10:04:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
需要使用Access用VBA批量替换PPT各幻灯片中形体中的文字的字体颜色,可使用以下代码
  1. Sub ReplaceColor()
  2. Dim shape As shape
  3. Dim slide As slide
  4. Dim txt As TextRange
  5. On Error Resume Next

  6. '替换背景颜色为白色
  7. ActivePresentation.SlideMaster.Background.Fill.Solid
  8. ActivePresentation.SlideMaster.Background.Fill.ForeColor.RGB = RGB(255, 255, 255)

  9. For Each slide In ActivePresentation.Slides
  10.    For Each shape In slide.Shapes
  11.       Set txt = shape.TextFrame.TextRange
  12.       For Each sentence In txt.Sentences
  13.         For Each word In sentence.Words
  14.           '把蓝色的文字替换成灰色
  15.           If word.Font.color.RGB = RGB(0, 0, 204) Or word.Font.color.RGB = RGB(0, 0, 122) Then
  16.             With word.Font
  17.               .color.RGB = RGB(40, 40, 40)
  18.             End With
  19.           End If
  20.         Next
  21.       Next
  22.    Next
  23. Next
  24. End Sub
复制代码
搜索自网络 秋,怡然若晴。的博文
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-27 14:07 , Processed in 0.088584 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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