Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Location
    Minneapolis, Minnesota, USA
    Posts
    54
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I'm playing a sound file using VBA, and the volume is really low. Is there a way that I can control volume using VBA code?

    I'm using this declaration:
    Private Declare Function PlaySound _
    Lib "winmm.dll" _
    Alias "sndPlaySoundA" ( _
    ByVal lpszSoundName As String, _
    ByVal uFlags As Long) As Long

    I'm using this code to play the sound:
    PlaySound "C:\Audio\Thump3.wav", 0&

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I have attached a text file with code that you can copy into a new module. [attachment=82955:Code.txt]
    The module contains one public procedure, SetVolume.
    You can use it like this:

    SetVolume 25000

    Ordinarily, the volume can be set to values ranging from 0 (mute) to 65535 (maximum)
    Attached Files Attached Files

  3. The Following User Says Thank You to HansV For This Useful Post:

    fcweyne (2013-01-25)

  4. #3
    Star Lounger
    Join Date
    Jan 2002
    Location
    Minneapolis, Minnesota, USA
    Posts
    54
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Hans,

    That worked well - solved my problem.

    Thanks much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •