我创建了一个子程序,要求用户提供音频文件地址,然后将其导入到 PowerPoint 中。是否有代码可以用来打开“修剪音频”对话框(功能区菜单 > 播放 > 修剪音频),以便用户可以在导入音频文件后对其进行修剪?
我知道您可以使用输入框询问起点和终点,然后使用
.Shape(AudioFileName).MediaFormat.StartPoint
和 .EndPoint
,但我更喜欢打开“修剪音频”对话框,因为它允许用户收听音频。
我搜索了微软的帮助文件,但不幸的是我找不到任何东西。
请尝试
Sub OpenAudioTrimDialog()
Dim sld As Slide
Dim shp As Shape
Set sld = ActivePresentation.Slides(1)
If sld.Shapes.Count > 0 Then
For Each shp In sld.Shapes
If shp.Type = 16 Then ' msoMedia
sld.Select
shp.Select
Application.CommandBars.ExecuteMso "AudioToolsTrim"
Exit Sub
End If
Next shp
End If
MsgBox "No audio"
End Sub