LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default TextBox.Visible = True ... not working

Hi there,
I use the code below to show some textboxes and images while I play a sound
( explaining these images)... the problem that I can't solve is that
sometimes the code works and sometimes not. The sounds are correct all the
time but sometimes after the first textbox the other objects remain
invisible. At the end the first textbox turn invisible so that part works
too.
I patched this together from the net and my VBA is not good enough to single
out the mistake here and I would appreciate any help.

Thank you,
Özgür


Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000


Private Sub Label2_Click()
If CheckBox1.Value = True Then
TextBox2.Visible = True
WAVFile = "Scenario2.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 18
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

TextBox3.Visible = True
Image3.Visible = True
WAVFile = "Scenario3.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 15
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Image3.Visible = False
Image2.Visible = True

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 3
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

TextBox2.Visible = False
TextBox3.Visible = False
Image2.Visible = False
Image3.Visible = False
End If
newHour = ""
newMinute = ""
newSecond = ""
End Sub
 
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
Application.Visible = True and focus hughie Excel Programming 3 January 16th 07 12:18 PM
ActiveWindow.Visible = True Paulo Alexandre ( PT ) Excel Programming 5 September 29th 06 12:02 PM
Shapes.visible = false/true Ctech[_122_] Excel Programming 2 March 22nd 06 02:25 PM
how to set pivotitem.visible property to true kanan Excel Programming 0 February 25th 04 08:06 PM
How can I set PivotItem.Visible property to True? yumi Excel Programming 2 February 19th 04 11:51 AM


All times are GMT +1. The time now is 10:46 AM.

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"