。 This MSDN articleは、MediaFormat
プロパティの一部(すべて?)を列挙します。 this articleからの助けを借りて
Option Explicit
Sub ReplaceMediaFormat()
Dim sld As Slide
Dim newShp As Shape
Dim shp As Shape
Dim mf As MediaFormat
Dim path As String
Set sld = ActivePresentation.Slides(1) '// Modify as needed
Set shp = sld.Shapes("bg_music")
Set mf = shp.MediaFormat
'// Modify the path for your new media file:
path = "C:\Users\david.zemens\Downloads\2540.mp3"
Set newShp = sld.Shapes.AddMediaObject2(path)
With newShp
.Top = shp.Top
.Left = shp.Left
.Width = shp.Width
.Height = shp.Height
' etc...
End With
' // copy the mediaformat properties as needed
With newShp.MediaFormat
.StartPoint = mf.StartPoint
.EndPoint = mf.EndPoint
.FadeInDuration = mf.FadeInDuration
.FadeOutDuration = mf.FadeOutDuration
.Muted = mf.Muted
.Volume = mf.Volume
' etc...
End With
'// remove the original
shp.Delete
Dim eff As Effect
'// Creates an effect in the timeline which triggers this audio to play when the slideshow begins
Set eff = sld.TimeLine.MainSequence.AddEffect(newShp, msoAnimEffectMediaPlay, trigger:=msoAnimTriggerWithPrevious)
With newShp.AnimationSettings.PlaySettings
.LoopUntilStopped = msoCTrue
.PauseAnimation = msoFalse
.PlayOnEntry = msoCTrue
.RewindMovie = msoCTrue
.StopAfterSlides = 999
.HideWhileNotPlaying = msoTrue
End With
、私は(Set eff = ...
上記参照)効果を作成することで、自動的に再生するオーディオを得ることができます。
ありがとうございます。しかし、私は「バックグラウンド再生」をどのように変更するか(各スライドのバックグラウンドで再生できるように)、さらにもう1つだけ必要です。 –
@DanielClímacoオブジェクトプロパティを表示するためにVBEのLocalsウィンドウを使用すると、 'newShp.AnimationSettings.PlaySettings'で行うことができます。 –
プロパティを見つけることができません "スライド間の再生"、それは私が欲しいものです(ちょうど名前を忘れた) –