Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button

Turn Down Volume on SOME Slides

We are often asked if it is possible to have music playing in the background which turns down (or off) for certain slides only, In the GUI this is not possible but it can be done with code that controls the master PC volume.

Note this is slightly unreliable and simplified code so be sure to check it works for what you need carefully.

Step One

Decide which slides to turn down the sound and which to turn it back up! In this example slides 2 and 4 turn it down and 3 and 5 back up again.

Step Two

Open the VB editor (ALT f11) and Insert a new module. Paste in the code below.

 

Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Const VK_VOLUME_MUTE = &HAD
Const VK_VOLUME_DOWN = &HAE
Const VK_VOLUME_UP = &HAF

Sub Turn_Up()
keybd_event VK_VOLUME_UP, 0, 1, 0
keybd_event VK_VOLUME_UP, 0, 3, 0
End Sub


Sub Turn_Down()
keybd_event VK_VOLUME_DOWN, 0, 1, 0
keybd_event VK_VOLUME_DOWN, 0, 3, 0
End Sub


Sub OnSlideShowPageChange(SW As SlideShowWindow)
Dim L As Long
Dim sldNum As Long
Const VolChange As Long = 50 'vol change amount
Select Case SW.View.CurrentShowPosition
Case Is = 2, 4 ' slides to turn down
For L = 1 To VolChange
Call Turn_Down
DoEvents
Next L
Case Is = 3, 5 ' slides to turn up
For L = 1 To VolChange
Call Turn_Up
DoEvents
Next L
End Select
End Sub

Step Three

Adapt to use the slides needed and the amount of volume change.

Step Four

To make sure the code runs reliably add a command button from the Control Toolbox to slide one and set its visiblility to NOT VISIBLE. There is no need to add any code.

Step Five

Test it!

 

 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation