Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The below shows the 2 MB's Twice -- OK the first time, but I ned to
eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
..enableevents will stop worksheet events, workbook events, application events
from firing. Not events for these controls. But you can mimic it: Dim BlkProc as boolean Private Sub ComboBox1_Change() if blkproc = true then exit sub MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" blkproc = true Me.ComboBox1.ListIndex = -1 blkproc = false End Sub Jim May wrote: The below shows the 2 MB's Twice -- OK the first time, but I ned to eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Dave. Can you reinterate a bit on what the code is doing here?
I can follow it some, but not all-the-way. Thanks, Jim "Dave Peterson" wrote: ..enableevents will stop worksheet events, workbook events, application events from firing. Not events for these controls. But you can mimic it: Dim BlkProc as boolean Private Sub ComboBox1_Change() if blkproc = true then exit sub MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" blkproc = true Me.ComboBox1.ListIndex = -1 blkproc = false End Sub Jim May wrote: The below shows the 2 MB's Twice -- OK the first time, but I ned to eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The code just sets a toggle. You turn it on right before you change something
that would cause the _change procedure to fire. It doesn't stop the event from firing a second time, but that first line says that if the toggle is on, don't do any of the real code--just get the heck out. And after you make the change, you turn that toggle off. Step through it and you'll see that it really does fire twice. Jim May wrote: Thanks Dave. Can you reinterate a bit on what the code is doing here? I can follow it some, but not all-the-way. Thanks, Jim "Dave Peterson" wrote: ..enableevents will stop worksheet events, workbook events, application events from firing. Not events for these controls. But you can mimic it: Dim BlkProc as boolean Private Sub ComboBox1_Change() if blkproc = true then exit sub MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" blkproc = true Me.ComboBox1.ListIndex = -1 blkproc = false End Sub Jim May wrote: The below shows the 2 MB's Twice -- OK the first time, but I ned to eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub -- Dave Peterson -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Pretty Cool, it's amazing what all you have to consider in doing something
like this. Thanks, Dave I (much) better understand - by stepping through the code. "Dave Peterson" wrote: The code just sets a toggle. You turn it on right before you change something that would cause the _change procedure to fire. It doesn't stop the event from firing a second time, but that first line says that if the toggle is on, don't do any of the real code--just get the heck out. And after you make the change, you turn that toggle off. Step through it and you'll see that it really does fire twice. Jim May wrote: Thanks Dave. Can you reinterate a bit on what the code is doing here? I can follow it some, but not all-the-way. Thanks, Jim "Dave Peterson" wrote: ..enableevents will stop worksheet events, workbook events, application events from firing. Not events for these controls. But you can mimic it: Dim BlkProc as boolean Private Sub ComboBox1_Change() if blkproc = true then exit sub MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" blkproc = true Me.ComboBox1.ListIndex = -1 blkproc = false End Sub Jim May wrote: The below shows the 2 MB's Twice -- OK the first time, but I ned to eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can observe a lot just by watching!
<vbg Jim May wrote: Pretty Cool, it's amazing what all you have to consider in doing something like this. Thanks, Dave I (much) better understand - by stepping through the code. "Dave Peterson" wrote: The code just sets a toggle. You turn it on right before you change something that would cause the _change procedure to fire. It doesn't stop the event from firing a second time, but that first line says that if the toggle is on, don't do any of the real code--just get the heck out. And after you make the change, you turn that toggle off. Step through it and you'll see that it really does fire twice. Jim May wrote: Thanks Dave. Can you reinterate a bit on what the code is doing here? I can follow it some, but not all-the-way. Thanks, Jim "Dave Peterson" wrote: ..enableevents will stop worksheet events, workbook events, application events from firing. Not events for these controls. But you can mimic it: Dim BlkProc as boolean Private Sub ComboBox1_Change() if blkproc = true then exit sub MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" blkproc = true Me.ComboBox1.ListIndex = -1 blkproc = false End Sub Jim May wrote: The below shows the 2 MB's Twice -- OK the first time, but I ned to eliminate them from ccurring the 2nd time (text only shows - no values) Thanks, Private Sub ComboBox1_Change() Application.EnableEvents = False MsgBox "You have chosen " & ComboBox1.Value MsgBox "The next step in this macro will deselect it" Me.ComboBox1.ListIndex = -1 Application.EnableEvents = True End Sub -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error message boxes.... | Excel Discussion (Misc queries) | |||
Message boxes | Excel Discussion (Misc queries) | |||
Built in message boxes | Excel Discussion (Misc queries) | |||
Built in message boxes | Excel Discussion (Misc queries) | |||
Hiding message boxes | Excel Discussion (Misc queries) |