p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Excel VBA (http://p2p.wrox.com/forumdisplay.php?f=79)
-   -   vba to un-mute pc audio. (http://p2p.wrox.com/showthread.php?t=100350)

FrancisM August 28th, 2019 01:08 PM

vba to un-mute pc audio.
 
I have several applications that have Excel Application.Speech. However, there is 1 user that keeps his PC muted. I am trying to use VBA to un-mute the audio if it is muted. I have found this code that un-mutes, & torments the user.
Code:

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

#If VBA7 Then
    Private Declare PtrSafe Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
#Else
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
#End If

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

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

Sub VolToggle()
  keybd_event VK_VOLUME_MUTE, 0, 1, 0
End Sub

I don't want to torment, just un-mute. I thought I would place the un-mute code, right before Application.speech runs. I have not been successful with my attempts. Is what6 I am asking possible?


All times are GMT -4. The time now is 10:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.