个人常用的VBA代码块

不会用的童鞋可以参考:如何使用VBA代码?

高效动画

赋予本页所有形状当前所选形状的动画

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Public Sub 赋予本页所有形状当前所选形状的动画()
'Code by ye4241
'只能运行于10,13版本的PPT
'务必选择一个形状后再运行该过程,否则报错哈~
'而且只会给可见的形状替换动画的,很适合一些页面重复动画批量动画刷。
Dim oShps As ShapeRange, oSh As Shape, i As Integer
Dim oSld As Variant
Set oShps = ActiveWindow.Selection.ShapeRange
Set oSld = oShps.Parent
Set oSh = oShps.Item(1)
oSh.PickupAnimation
For i = 1 To oSld.Shapes.Count
If oSld.Shapes(i).Visible Then oSld.Shapes(i).ApplyAnimation
Next i
End Sub

批量修改所选幻灯片的换页时长

1
2
3
4
5
6
7
8
9
10
11
Public Sub 批量修改所选幻灯片的换页时长()
'Code by ye4241
'务必选择一页或多页幻灯片后再运行该过程,否则报错哈~
'你可以修改0.5这个数值,就能批量修改其换页时长为这个值了。
'如果你某个页面没有设置过切换,那么这一页不会产生任何效果的!
Dim oSld As Slide, oSlides As SlideRange
Set oSlides = ActiveWindow.Selection.SlideRange
For Each oSld In oSlides
oSld.SlideShowTransition.Duration = 0.5
Next
End Sub

高效形状

(下次更新哈)