Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Y TestBox don't Change?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Y TestBox don't Change?
You are probably not setting the filenames correctly.
Add some debug code, such as a Msgbox showing the variable values to see what the value is. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Soniya" wrote in message ups.com... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Y TestBox don't Change?
When Added this:
after CmbRef.ListIndex = CmbRef.ListIndex + 1 MsgBox ("Now the Text shud change") it shows the msgbox and changes the text box... I know it changes but not get displayed in the text box. because the sound changes and the the fist two cells show then last cell value is shown in the text box. it fails to display from third onwards.. I tried to set ScreenUpdating to true still not working... Code works, but the text not displyed.. thanks..! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Y TestBox don't Change?
Try adding stuff like
MsgBox CmbRef.Value and so on to check what values are being passed around. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Soniya" wrote in message oups.com... When Added this: after CmbRef.ListIndex = CmbRef.ListIndex + 1 MsgBox ("Now the Text shud change") it shows the msgbox and changes the text box... I know it changes but not get displayed in the text box. because the sound changes and the the fist two cells show then last cell value is shown in the text box. it fails to display from third onwards.. I tried to set ScreenUpdating to true still not working... Code works, but the text not displyed.. thanks..! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Y TestBox don't Change?
Thanks for your reply...
When I put MsgBox CmbRef.Value I Could see exactly those texts what I needed. I know CmbRef changes since the the sound file name is taken from the CmbRef.value and all sounds are played well. But CmbRef.change event has the code to show the corresponding text which is not shown prperly. It displayes first two and then the last. If I manually change CmbRef.value then all the texts shown properly. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
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 |