Powerpoint change sound effect volume in macro

倾然丶 夕夏残阳落幕 提交于 2021-01-29 07:11:13

问题


is there a way that i can change the volume of a sound effect object through vba/a macro in powerpoint? even mute and unmute would be sufficient for what I am trying to do.


回答1:


Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)

With oSh.MediaFormat
    .Volume = 1     ' scale is 0 to 1
    .Muted = False  ' | True
End With



回答2:


a very ugly workaround. I am sure there is a better way of doing this, but here it is

Sub mute()
Dim gameSlide As Slide
Set gameSlide = ActivePresentation.Slides("Round Board")
gameSlide.Shapes("numSound 5").MediaFormat.StartPoint = gameSlide.Shapes("numSound 5").MediaFormat.Length - 1
End Sub

Sub unmute()
Dim gameSlide As Slide
Set gameSlide = ActivePresentation.Slides("Round Board")
gameSlide.Shapes("numSound 5").MediaFormat.StartPoint = 0
gameSlide.Shapes("numSound 5").MediaFormat.EndPoint = gameSlide.Shapes("numSound 5").MediaFormat.Length
End Sub


来源:https://stackoverflow.com/questions/21647225/powerpoint-change-sound-effect-volume-in-macro

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!