我有几个 PowerPoint 演示文稿中的音频文件。我希望它们全部自动播放(而不是通过点击)。有没有可能用vba宏来做到这一点? 此代码运行,但没有任何变化:
Sub SetAudioToPlayAutomatically()
Dim sld As slide
Dim shp As shape
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoMedia Then
If shp.MediaType = ppMediaAudio Then
Set oEffect = sld.TimeLine.MainSequence.AddEffect(shp, msoAnimEffectMediaPlay, , msoAnimTriggerWithPrevious)
oEffect.MoveTo 1
End If
End If
Next shp
Next sld
MsgBox "All audiofiles set to automatic play.", vbInformation
End Sub
我也尝试了
shp.AnimationSettings.PlaySettings.StartingEffect = ppAnimationStartAutomatically
,但是出现了编译错误——未知值ppAnimationStartAutomatically
。预先感谢!