Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel graphs change when pasted into Publisher - Metafiles change? Ericd1 Charts and Charting in Excel 0 February 1st 10 01:57 AM
change cell contents when pull down menu choices change jb21 Excel Worksheet Functions 3 November 21st 08 10:34 PM
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"