I've created a sub that asks users for an audio file address, then imports it into the PowerPoint. Is there code that I can use to open the Trim Audio dialog box (Ribbon menu > Playback > Trim Audio) so that users can trim the audio file after it's been imported?
I know that you could use inputboxes to ask for the start and end point and then use .Shape(AudioFileName).MediaFormat.StartPoint
and .EndPoint
, but I'd prefer to open the Trim Audio dialog box because it allows users to listen to the audio.
I've searched the Microsoft help files, but unfortunately I can't find anything.
Please try
Sub OpenAudioTrimDialog()
Dim sld As Slide
Dim shp As Shape
' Get the active slide
Set sld = ActiveWindow.View.Slide
If sld.Shapes.Count > 0 Then
For Each shp In sld.Shapes
If shp.Type = 16 Then ' msoMedia
shp.Select
' open Trim Audio dialog
Application.CommandBars.ExecuteMso "AudioToolsTrim"
Exit Sub
End If
Next shp
End If
MsgBox "No shape on slide"
End Sub
Please refers to Microsoft document.