VBA实现大量修改ppt中shape里字的颜色
时间:2011-06-09
来源:互联网
修改需要选中当前幻灯片,这样就有个很大的问题了:在运行时,虽有有一行命令选中当前幻灯片,但是命令运行后,需要操作的幻灯片还没选中后面的语句就已经执行完了。比如我ppt显示的是第一页,那么程序执行完毕之后,只有第一页的颜色被修改了,后面得都没动。我试着加了个延时,一个是用循环控制时间,CPU使用率100%;另外一个是用api sleep,根本没效果,可能是sleep的时候ppt已经被阻塞...最后我是在选中要操作的幻灯片后设置了一个断点,手动控制....好麻烦....
不知道各位大侠有没有什么好办法。
Sub aa()
Dim OS As Slide
Dim OA As String
Dim n1 As Integer
Dim n2 As Integer
Dim i1 As Integer
Dim i2 As Integer
On Error Resume Next
n1 = ActivePresentation.Slides.Count
For Each OS In ActivePresentation.Slides
Debug.Print i1
OS.Select‘断点在这个后面
n2 = OS.Shapes.Count ' ActivePresentation.Slides(i1).Shapes.Count
For i2 = 1 To n2
ActiveWindow.Selection.SlideRange.Shapes(i2).Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.TextRange.Font.Color.SchemeColor = ppShadow
With ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppShadow
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
ActiveWindow.Selection.ShapeRange.GroupItems(Index:=2).TextFrame.TextRange.Select
ActiveWindow.Selection.TextRange.Font.Color.SchemeColor = ppShadow
Next
Next
End Sub
不知道各位大侠有没有什么好办法。
Sub aa()
Dim OS As Slide
Dim OA As String
Dim n1 As Integer
Dim n2 As Integer
Dim i1 As Integer
Dim i2 As Integer
On Error Resume Next
n1 = ActivePresentation.Slides.Count
For Each OS In ActivePresentation.Slides
Debug.Print i1
OS.Select‘断点在这个后面
n2 = OS.Shapes.Count ' ActivePresentation.Slides(i1).Shapes.Count
For i2 = 1 To n2
ActiveWindow.Selection.SlideRange.Shapes(i2).Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.TextRange.Font.Color.SchemeColor = ppShadow
With ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppShadow
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
ActiveWindow.Selection.ShapeRange.GroupItems(Index:=2).TextFrame.TextRange.Select
ActiveWindow.Selection.TextRange.Font.Color.SchemeColor = ppShadow
Next
Next
End Sub
作者: xzl8833 发布时间: 2011-06-09
上附件吧。
作者: guojianlin1985 发布时间: 2011-06-09
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28