Extract all recorded audio times from a ppt

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Extract all recorded audio times from a ppt

Post by gailb »

Two questions here.

1) How can I extract the lengths of audio time from each slide? There are 40 slides.

2) How can I use VBA to update each of the playbacks to start automatically?

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Extract all recorded audio times from a ppt

Post by HansV »

Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Extract all recorded audio times from a ppt

Post by HansV »

Here is an extended version of the macro from the above link:

Code: Select all

Sub SoundMediaLength()
    Dim sld As Slide
    Dim shp As Shape
    Dim total As Long
    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.Type = msoMedia Then
                If shp.MediaType = ppMediaTypeSound Then
                    Debug.Print shp.MediaFormat.Length
                    total = total + shp.MediaFormat.Length
                End If
            End If
        Next shp
    Next sld
    Debug.Print "Total: " & total
End Sub
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Extract all recorded audio times from a ppt

Post by HansV »

2) I don't know enough about PowerPoint VBA, sorry. I tried this, but it doesn't work for me:

Code: Select all

Sub SoundMediaLength()
    Dim sld As Slide
    Dim shp As Shape
    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
                    '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
I hope someone else knows. Otherwise, you might ask this in the PowerPoint forum on Microsoft Community
Best wishes,
Hans

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Re: Extract all recorded audio times from a ppt

Post by gailb »

Thanks Hans. I'll go to the PowerPoint forum on MS community and ask.