PowerPoint VBA:如何将动画开始事件设置为;与先前的;
在PowerPoint宏中,我想将“动画”选项卡上“计时”组中的“开始”设置为“使用上一个”。今天是我第一次使用VBA,所以请不要嘲笑我的代码: 子调整全部() 将osld设置为幻灯片 将oshp调暗为形状PowerPoint VBA:如何将动画开始事件设置为;与先前的;,vba,powerpoint,Vba,Powerpoint,在PowerPoint宏中,我想将“动画”选项卡上“计时”组中的“开始”设置为“使用上一个”。今天是我第一次使用VBA,所以请不要嘲笑我的代码: 子调整全部() 将osld设置为幻灯片 将oshp调暗为形状 For Each osld In ActivePresentation.Slides For Each oshp In osld.Shapes If oshp.Type = msoMedia Then If oshp.MediaType = p
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoMedia Then
If oshp.MediaType = ppMediaTypeSound Then
oshp.Left = 460.7499
oshp.Top = 250.7499
oshp.AnimationSettings.PlaySettings.LoopUntilStopped = True
End If
End If
Next oshp
Next osld
End Sub
For Each osld In ActivePresentation.Slides
For i = osld.TimeLine.MainSequence.Count To 1 Step -1
osld.TimeLine.MainSequence(i).Delete
Next i
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then
If oshp.Name <> "Content Placeholder 2" Then
oshp.AnimationSettings.Animate = False
End If
If oshp.Name = "Content Placeholder 2" Then
Set oeff = osld.TimeLine.MainSequence.AddEffect(Shape:=oshp, effectid:=msoAnimEffectAppear, trigger:=msoAnimTriggerOnPageClick)
oshp.AnimationSettings.AnimationOrder = 1
End If
End If
If oshp.Type = msoMedia Then
If oshp.MediaType = ppMediaTypeSound Then
Set oeff = osld.TimeLine.MainSequence.AddEffect(Shape:=oshp, effectid:=msoAnimEffectMediaPlay, trigger:=msoAnimTriggerWithPrevious)
oshp.Left = 460.7499
oshp.Top = 250.7499
oshp.ScaleHeight 0.2, msoTrue
oshp.ScaleWidth 0.2, msoTrue
oshp.AnimationSettings.PlaySettings.LoopUntilStopped = True
End If
End If
Next oshp
Next osld
End Sub
也许我需要使用AddEffect(),但这似乎有点过于复杂了?我看过一些文档和帖子,但没有找到要设置的属性或要应用的值
我不想问多个问题,但如果有人能进一步帮助我或告诉我在哪里进行RTFM,对于另一个对象,我想将相同的设置为“点击”,并在“动画”组中设置“出现”,在“效果选项”中设置“作为一个对象”
更新:这非常接近工作:
子调整全部()
将osld设置为幻灯片
将oshp调暗为形状
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoMedia Then
If oshp.MediaType = ppMediaTypeSound Then
oshp.Left = 460.7499
oshp.Top = 250.7499
oshp.AnimationSettings.PlaySettings.LoopUntilStopped = True
End If
End If
Next oshp
Next osld
End Sub
For Each osld In ActivePresentation.Slides
For i = osld.TimeLine.MainSequence.Count To 1 Step -1
osld.TimeLine.MainSequence(i).Delete
Next i
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then
If oshp.Name <> "Content Placeholder 2" Then
oshp.AnimationSettings.Animate = False
End If
If oshp.Name = "Content Placeholder 2" Then
Set oeff = osld.TimeLine.MainSequence.AddEffect(Shape:=oshp, effectid:=msoAnimEffectAppear, trigger:=msoAnimTriggerOnPageClick)
oshp.AnimationSettings.AnimationOrder = 1
End If
End If
If oshp.Type = msoMedia Then
If oshp.MediaType = ppMediaTypeSound Then
Set oeff = osld.TimeLine.MainSequence.AddEffect(Shape:=oshp, effectid:=msoAnimEffectMediaPlay, trigger:=msoAnimTriggerWithPrevious)
oshp.Left = 460.7499
oshp.Top = 250.7499
oshp.ScaleHeight 0.2, msoTrue
oshp.ScaleWidth 0.2, msoTrue
oshp.AnimationSettings.PlaySettings.LoopUntilStopped = True
End If
End If
Next oshp
Next osld
End Sub
PowerPoint编程有点过于复杂。AddEffect正是您需要使用的:
Sub AdjustTable()
Dim oSlide As Slide
Dim oShape As Shape
Dim oEffect As Effect
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSld.Shapes
If oShape.Type = msoMedia Then
If oShape.MediaType = ppMediaTypeSound Then
oShape.Left = 460.7499
oShape.Top = 250.7499
Set oEffect = oSlide.TimeLine.MainSequence.AddEffect(Shape:=oShape, _
effectid:=msoAnimEffectMediaPlay, MsoAnimateByLevel:=msoAnimateLevelNone, _
MsoAnimTriggerType:=msoAnimTriggerWithPrevious)
End If
End If
Next oShape
Next oSlide
End Sub
顺便说一句,如果您只检查媒体类型的占位符,您将错过插入内容占位符中的任何视频。请为您的第二个问题启动一个新线程。谢谢我只想对约翰·科乔克的迅速回答表示超级感谢。这似乎解决了我的第二个问题,尽管我有一个关于多个触发器的奇怪问题(参见屏幕截图)。再次感谢!