جهت پخش فایل صوتی در اکسل بایستی از API های ویندوز استفاده نمود که برای فراخوانی آنها از declare statement استفاده می شود لذا جهت شروع بایستی API مربوطه را فراخوانی نمائیم

Public Declare Function Sound32 _
    Lib "winmm.dll" _
    Alias "sndPlaySoundA" ( _
        ByVal lpszSoundName As String, _
        ByVal uFlags As Long) As Long

سپس در هر بخش از کد که نیاز به پخش یک فایل صوتی است تابع فوق را فراخوانی می کنیم مشابه زیر

Call sound32(WAVFile, snd_sync)

wavfile مسیر قرارگیری فایل است و گزینه بعدی نحوه پخش را مشخص می کند که پیش فرض snd_sync می باشد

Const SND_SYNC = &H0        ' (Default) Play the sound synchronously. Code execution
                            ' pauses until sound is complete.

Const SND_ASYNC = &H1       ' Play the sound asynchronously. Code execution
                            ' does not wait for sound to complete.

Const SND_NODEFAULT = &H2   ' If the specified sound is not found, do not play
                            ' the default sound (no sound is played).

Const SND_MEMORY = &H4      ' lpszSoundName is a memory file of the sound.
                            ' Not used in VBA/VB6.

Const SND_LOOP = &H8        ' Continue playing sound in a loop until the next
                            ' call to sndPlaySound.

Const SND_NOSTOP = &H10     ' Do not stop playing the current sound before playing
                            ' the specified sound.

نقل شده از

http://www.cpearson.com/excel/PlaySound.aspx

https://excel.tips.net/T006559_Conditionally_Playing_an_Audio_File.html

برگرداندن فکوس به جعبه متن#How to put focus to textbox as needed

جا به جا شدن نمودار در اکسل با اسکرول-macro for move chart with scroll

خطای error cannot shift objects off sheet

sound ,snd ,the ,const ,not ,playing ,const snd ,the sound ,snd sync ,play the ,sound is

مشخصات

تبلیغات

آخرین ارسال ها

برترین جستجو ها

آخرین جستجو ها

پیش بینی ورزش - ورزش ما، مرجعی برای توسعه ورزش کشور مــــای آر بــــی تیــ قلم زنی روی پلاک و تابلو رهپویان هدایت برنامه ریزی | آزمون | کلاس برترین های 98 مهاجرت به اسپانیا,اقامت اسپانیا,تحصیل در اسپانیا شایان قادرپور ماشین های راه سازی و ساختمان سازی کوچک علم ورزش