I am trying to find some code to turn my speaker volume on, up or down.
I am using the Speak function if that has any relevance...... thanks!
Really, Really hard to find a way - I was even trying to adjust external amps with 0-10V via USB!
I found this:
View / change sound volume on Windows 11/10/7/8/2008 from command-line or GUI
I got the zip file and copied the files to C:\ just to be handy.
Then I had to find out how to run a ".exe" from VBA.
This worked:
("Realtek High Definition Audio" is the "Friendly name" from looking at SoundVolumeView.exe in Windows.)
(I don't know where these .wav files are from , but
Freesound - sound search has many)
'========================================= Sound Balance TEST
Shell "C:\SoundVolumeView.exe /SetVolumeChannels ""Realtek High Definition Audio\Device\Speakers\Render"" 24 62", vbNormalFocus
Call PlaySound(Application.ActiveWorkbook.Path & "\ringin.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Shell "C:\SoundVolumeView.exe /SetVolumeChannels ""Realtek High Definition Audio\Device\Speakers\Render"" 62 24", vbNormalFocus
Call PlaySound(Application.ActiveWorkbook.Path & "\ringin.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Shell "C:\SoundVolumeView.exe /SetVolumeChannels ""Realtek High Definition Audio\Device\Speakers\Render"" 24 62", vbNormalFocus
Call PlaySound(Application.ActiveWorkbook.Path & "\blip.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Shell "C:\SoundVolumeView.exe /SetVolumeChannels ""Realtek High Definition Audio\Device\Speakers\Render"" 62 24", vbNormalFocus
Call PlaySound(Application.ActiveWorkbook.Path & "\blip.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Shell "C:\SoundVolumeView.exe /SetVolumeChannels ""Realtek High Definition Audio\Device\Speakers\Render"" 21 21", vbNormalFocus
Call PlaySound(Application.ActiveWorkbook.Path & "\ringin.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Call PlaySound(Application.ActiveWorkbook.Path & "\blip.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
Call PlaySound(Application.ActiveWorkbook.Path & "\testsnd.wav", 0, SND_SYNC Or SND_FILENAME Or SND_NOSTOP)
'========================================= Sound Balance TEST