Option Explicit
'Mostly from
'http://www.mrexcel.com/forum/showthread.php?p=2291517
'http://www.pcreview.co.uk/forums/api-commands-turn-volume-control-t1008148.html
'http://support.microsoft.com/default.aspx?scid=kb;en-us;178456
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 'Windows 2000/XP: Volume Mute key
Const VK_VOLUME_DOWN = &HAE 'Windows 2000/XP: Volume Down key
Const VK_VOLUME_UP = &HAF 'Windows 2000/XP: Volume Up key
Sub VolUp()
'-- Turn volumn up --
keybd_event VK_VOLUME_UP, 0, 1, 0
keybd_event VK_VOLUME_UP, 0, 3, 0
End Sub
Sub VolDown()
'-- Turn volumn down --
keybd_event VK_VOLUME_DOWN, 0, 1, 0
keybd_event VK_VOLUME_DOWN, 0, 3, 0
End Sub
Sub VolToggle()
'-- Toggle mute on / off --
keybd_event VK_VOLUME_MUTE, 0, 1, 0
End Sub