Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to prevent and event?
In a textbox.afterupdate() event, I have a line to make the
textbox.visible FALSE. This triggers another afterupdate event. How do I suppress this? Private Sub TextBox1_afterupdate() TextBox1.Text = "" TextBox1.Visible = False End Sub Thank you! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to prevent and event?
Private Sub TextBox1_afterupdate()
dim NotNow as boolean If Notnow then exit sub NotNow = true TextBox1.Text = "" TextBox1.Visible = False NotNow = False End Sub "SMS" wrote in message ... In a textbox.afterupdate() event, I have a line to make the textbox.visible FALSE. This triggers another afterupdate event. How do I suppress this? Private Sub TextBox1_afterupdate() TextBox1.Text = "" TextBox1.Visible = False End Sub Thank you! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to prevent and event?
Hi
Turn off events before you manipulate the textbox, just remember to turn it on again. Private Sub TextBox1_afterupdate() Application.EnableEvents=False TextBox1.Text = "" TextBox1.Visible = False Application.EnableEvents=True End Sub Regards, Per "SMS" skrev i meddelelsen ... In a textbox.afterupdate() event, I have a line to make the textbox.visible FALSE. This triggers another afterupdate event. How do I suppress this? Private Sub TextBox1_afterupdate() TextBox1.Text = "" TextBox1.Visible = False End Sub Thank you! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to prevent and event?
That won't work -- events are not "events" as far as userforms are
concerned, and if you step thru the code you'll see it fires again. My original code did have an error, however; the variable NotNow needs to be dimmed at the top of the module, not inside the sub: dim NotNow as boolean Private Sub TextBox1_afterupdate() If Notnow then exit sub NotNow = true TextBox1.Text = "" TextBox1.Visible = False NotNow = False End Sub "Per Jessen" wrote in message ... Hi Turn off events before you manipulate the textbox, just remember to turn it on again. Private Sub TextBox1_afterupdate() Application.EnableEvents=False TextBox1.Text = "" TextBox1.Visible = False Application.EnableEvents=True End Sub Regards, Per "SMS" skrev i meddelelsen ... In a textbox.afterupdate() event, I have a line to make the textbox.visible FALSE. This triggers another afterupdate event. How do I suppress this? Private Sub TextBox1_afterupdate() TextBox1.Text = "" TextBox1.Visible = False End Sub Thank you! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to prevent and event?
Thanks for the workaround... it is interesting that events on a
userform are somehow different. I wonder if there is an easy way to understand the descrepancies between the UFs and the standard sheets wrt events. On Oct 2, 10:37*am, "Bob Umlas" wrote: That won't work -- events are not "events" as far as userforms are concerned, and if you step thru the code you'll see it fires again. My original code did have an error, however; the variable NotNow needs to be dimmed at the top of the module, not inside the sub: dim NotNow as boolean Private Sub TextBox1_afterupdate() * * If Notnow then exit sub * * NotNow = true * * TextBox1.Text = "" * * TextBox1.Visible = False * * NotNow = False *End Sub "Per Jessen" wrote in message ... Hi Turn off events before you manipulate the textbox, just remember to turn it on again. Private Sub TextBox1_afterupdate() Application.EnableEvents=False * *TextBox1.Text = "" * *TextBox1.Visible = False Application.EnableEvents=True End Sub Regards, Per "SMS" skrev i meddelelsen .... In a textbox.afterupdate() event, I have a line to make the textbox.visible FALSE. *This triggers another afterupdate event. *How do I suppress this? Private Sub TextBox1_afterupdate() * *TextBox1.Text = "" * *TextBox1.Visible = False End Sub Thank you!- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prevent event macro from executing on ALT-Enter | Excel Programming | |||
Prevent Corollary Event | Excel Programming | |||
Prevent automatic combobox event trigger | Excel Programming | |||
prevent event procedure under condition | Excel Programming | |||
Prevent Change in Event when not needed | Excel Programming |