Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
The following code I recieved from this newsgroup: Private Declare Function sndPlaySound Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub PlayWavFile(WavFileName As String, Wait As Boolean) If Dir(WavFileName) = "" Then Exit Sub ' no file to play If Wait Then ' play sound before running any more code sndPlaySound WavFileName, 0 Else ' play sound while code is running sndPlaySound WavFileName, 1 End If End Sub Now I am trying to play a sound file and change TextBox Text from the following, but text box dont change. under the CmbRef change I have code to change the text in TextBox1. I know the CmbRef changes and the coresponding sound file is played but for some reason it is not displaying the text in the textbox. What I am trying to do is that play display a text in textbox and play a sound file according to user selection in combobox CmbRecF (starting) and combobox CmbRecT(ending). based on this selection in my sheet1 column A text is displayed in textbox and sound played. I have all those thing working properly excepet the display of corresponding text while playing the sound. Sub TestSoundFile() Dim WAVFile As String Dim v As Variant Dim Y, Z As Variant v = Split(CmbRef, ":") Y = Format(v(0), "000") Z = Format(v(1), "000") WAVFile = Y & z & ".wav" WAVFile = "D:\Folder\Mele\" & WAVFile PlayWavFile WAVFile, True End Sub Private Sub CmdSound_Click() Application.ScreenUpdating = True If CmbRecT.ListIndex < CmbRecF.ListIndex Then CmbRecT = CmbRecF End If Do While CmbRef <= CmbRecT TestSoundFile If CmbRef = CmbRecT Then Exit Sub CmbRef.ListIndex = CmbRef.ListIndex + 1 Application.Wait (Now + TimeValue("0:00:01")) Loop End Sub Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel graphs change when pasted into Publisher - Metafiles change? | Charts and Charting in Excel | |||
change cell contents when pull down menu choices change | Excel Worksheet Functions | |||
Excel bar chart formatting of bars to change colors as data change | Excel Discussion (Misc queries) | |||
Use date modified to change format & create filter to track change | Excel Worksheet Functions | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming |