1) what in this macro is duplicating the media that is already there
2) How can I delete the duplicate media?
The media is already on the slide, this macro should just add the advance time, unmute, and set the volume.
Code: Select all
Sub SoundMediaLength3() Dim sld As Slide Dim shp As Shape Dim myTime As Long Dim eff As Effect For Each sld In ActivePresentation.Slides For Each shp In sld.Shapes If shp.Type = msoMedia Then If shp.MediaType = ppMediaTypeSound Then With sld.SlideShowTransition shp.MediaFormat.Volume = 1 ' scale is 0 to 1 shp.MediaFormat.Muted = False ' True or False .AdvanceOnClick = msoTrue .AdvanceOnTime = msoTrue myTime = Left(shp.MediaFormat.Length, 2) .AdvanceTime = myTime + 1 .EntryEffect = ppEffectWipeRight End With 'Set audio to play automatically Set eff = sld.TimeLine.MainSequence.AddEffect(shp, msoAnimEffectMediaPlay, , msoAnimTriggerWithPrevious) eff.EffectInformation.PlaySettings.HideWhileNotPlaying = True End If End If Next shp Next sld End Sub