Following on from the code here (Using VBA Speech) the code below is used to make adjust the speaker volume, including turning mute on / off.
Private Declare Sub keybd_event Lib "user32" ( _ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
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
Again, this requires the PC to a sound card and speakers.
No comments:
Post a Comment
Please, no purely anonymous comments, they will be deleted; always use a name for ease of reference by other commenters.