【发布时间】:2021-05-21 11:38:12
【问题描述】:
我的 Office 365 PowerPoint 演示文稿只有一张幻灯片。该幻灯片包含一个带有嵌入(未链接,非 OLE)视频的形状,该视频最初是从 .mp4 文件插入的。当我点击它时视频开始播放,但我需要从 VBA 代码控制它。我没有尝试过(见下文),当然我没有收到任何错误消息或任何反馈。如何从代码开始(和停止)视频?
Sub PlayVideo(Name)
Set Shape = GetShape(Name)
' Shape.MediaType == ppMediaTypeMovie
With Shape.AnimationSettings
.Animate = msoTrue
.AdvanceMode = ppAdvanceOnTime
.AdvanceTime = 0
.TextLevelEffect = ppAnimateByAllLevels
With .PlaySettings
.PlayOnEntry = msoTrue
.PauseAnimation = msoFalse
.LoopUntilStopped = msoTrue
End With
End With
With Slide.TimeLine.MainSequence
Set AnimationEffect = .AddEffect(Shape:=Shape, effectid:=msoAnimEffectMediaPlay)
With AnimationEffect
Set Behaviour = .Behaviors.Add(msoAnimTypeCommand)
With Behaviour
.CommandEffect.Type = msoAnimCommandTypeVerb
.CommandEffect.Command = "play"
End With
End With
End With
End Sub
【问题讨论】:
-
includes a shape with embedded (not linked, not OLE) video视频是如何嵌入的? -
@SiddharthRout 我这样嵌入视频:工具栏 > 插入选项卡 > 视频 > 此设备 > [...\algorithm panel.mp4]
标签: vba video powerpoint