Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox.Visible = True ... not working
Hi
Try putting in some "DoEvents" lines after making the buttons visible. This often sorts out this kind of graphics updating problem. I didn't look at your code in detail though, so it may be something else! regards Paul e.g. TextBox2.Visible = True DoEvents On Apr 16, 8:38 am, Ozgur Pars wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox.Visible = True ... not working
Paul thanks for the reply will try it out and let you know about the result. Özgür " wrote: Hi Try putting in some "DoEvents" lines after making the buttons visible. This often sorts out this kind of graphics updating problem. I didn't look at your code in detail though, so it may be something else! regards Paul e.g. TextBox2.Visible = True DoEvents On Apr 16, 8:38 am, Ozgur Pars wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox.Visible = True ... not working
Paul thank you very much it worked.
Özgür " wrote: Hi Try putting in some "DoEvents" lines after making the buttons visible. This often sorts out this kind of graphics updating problem. I didn't look at your code in detail though, so it may be something else! regards Paul e.g. TextBox2.Visible = True DoEvents On Apr 16, 8:38 am, Ozgur Pars wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.Visible = True and focus | Excel Programming | |||
ActiveWindow.Visible = True | Excel Programming | |||
Shapes.visible = false/true | Excel Programming | |||
how to set pivotitem.visible property to true | Excel Programming | |||
How can I set PivotItem.Visible property to True? | Excel Programming |