Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a sound file to the system? "Welcome"?

Status
Not open for further replies.
Feb 19, 2005
47
0
0
GB
Hi, is it possible to add the automatic playing of a welcome sound file to an autoexec macro? IThe macro presently opens the password form, and on entry of the correct password, opens the main menu page. Would it be possible to play a welcome sound when the main menu form is displayed? If so, can anyone reccommend where I could get hold of one? Thanks!
 
On a XP box, in VBA:
Set vo = CreateObject("SAPI.SpVoice")
vo.Speak "welcomme"
Set vo = Nothing

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I forgot where I found it but this is another method I have used in the past to play a sound. Just set an event such as a form's OnOpen to:

=PlaySound("C:\winnt\chimes.wav")

Paste the declaration and function into a module, and save:


Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long


Function PlaySound(sWavFile As String)
' Purpose: Plays a sound.
' Argument: the full path and file name.

If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If
End Function


 
PHV and OBLI.

Thank you for your help, but I am confused as to how to go about implementing this code... How do I use these codes to get a welcome sound?
 
GoldenFireTiger,

Lacking any sophisticated tools or knowledge myself, if I want to use a particular word I go to an on-line dictionary such as that has an audio pronunciation feature, type in the word I want, click the audio icon to hear the word and click the link that allows you to listen with your default audio player. When the sound is being played on my Real Audio player I make note of the file name,find it on my PC, rename it to whatever I want and substitute the path for the one in the example.
 
Thanks for that, I will check out the website. When I find one, do I ionly need to alter the first line of the code to include the name of the file?
 
Alter the path in =PlaySound("C:\winnt\chimes.wav[/color")to point to where you actually saved the wav file.
 

oops..

Alter the path in =PlaySound("C:\winnt\chimes.wav")to point to where you actually saved the wav file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top