Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2019, 01:08 PM
Registered User
 
Join Date: Feb 2017
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Question 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?





Similar Threads
Thread Thread Starter Forum Replies Last Post
need help wid audio in c DragoKnight C++ Programming 0 August 25th, 2007 06:38 PM
Play Audio sumith ASP.NET 1.0 and 1.1 Basics 1 February 23rd, 2007 09:03 AM
play audio sumith ASP.NET 1.0 and 1.1 Professional 0 February 23rd, 2007 01:19 AM
Recording audio? larry Javascript How-To 1 May 25th, 2006 10:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.