Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 28th, 2019, 01:08 PM
Registered User
Points: 47, Level: 1
Points: 47, Level: 1 Points: 47, Level: 1 Points: 47, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:05 PM.


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