‘ make sure Volume stays on top so keystrokes are sent to it. WshShell.Run “%SystemRoot%System32sndvol32.exe /t” ‘ Open Volume Control in single slider view Set WshShell = WScript.CreateObject(“WScript.Shell”) There may be some shell commands available for use, but I’m not sure. To execute this program with command-line arguments, go to the Start menu, click Run Xforce. To display this volume control, go to the Control Panel and start Sounds and Audio Devices. I think something like this would be better dealt with using API calls from an ActiveX Control. The SndVol32.exe program controls the volume settings for your system. I know the script isn’t VBA, but nobody else has so far commented so you may as well see one method. There may be better ways, but I’m not a programmer. To mitigate the risk, the *.vbs code in the Code Snippet tries to maintain focus on the volume control while it simulates keystrokes. There would be a few ways of unmuting and max’ing your master volume using basic *.vbs, but they are very clunky and if focus of the object is lost by clicking around or pressing keyboard keys while the VB Script is running, the SendKeys function can send the keystrokes to another application window. While open Ctrl + S toggles between small and normal (wide) view.
#SNDVOL32/R FULL#
Sndvol32 /s open full mixer in playback mode – SMALL Sndvol32 /p – open full mixer in “playback” view Sndvol32 /r – open full mixer in “record” view Sndvol32 /t – shows single master volume slider like System Tray Set WshShell = CreateObject(“WScript.Shell”)Īs a matter of interest, the volume control in Windows XP (and I assume upwards) has a few command line switches:
There are other methods that use 3rd-party programs to which are assigned, or to which you can assign, keyboard shortcuts, or which you can call from the command line, eg:įurther to the above, you can use a simple *.vbs code that sends the same key code as multimedia keyboards use to toggle the master volume’s Mute check-box on and off without displaying the volume control: It was written as a method for setting volume level at logon via a script, but you may be able find it interesting nevertheless. The author of the following page has created a self-registering *.DLL (ActiveX Control) that allows you to call it using a *.vbs script:
#SNDVOL32/R HOW TO#
Solution: How to unmute windows sound master volume and then increase the volume to max, using VBAįrom the following page giving an example full Visual Basic project demonstrating how to manipulate volume control settings: