title: Play sound file from within VBScript when msgbox appears
body: <p>I am trying to play a sound file from within a VBScript when a certain msgbox appears. The only problem is that I will be sending this elsewhere and the person who receives it won't have the same pathname as the audio file that I want to play. I was thinking about putting all of the sound files that I want to use in the same folder as the script and then sending that folder, but I don't know how to make sure the sound file will play.</p>
  
  <p>So I guess the biggest question is how to generalize the pathname so that anyone can hear the file from within the script from any machine.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>    if intAnswer3 = vbyes then
          strSoundFile = "C:\pathname"
          Set objShell = CreateObject("Wscript.Shell")
          strCommand = "sndrec32 /play /close " &amp; chr(34) &amp; strSoundFile &amp; chr(34)
          objShell.Run strCommand, 0, True
  </code></pre>