Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SMS SMS is offline
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default 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   Report Post  
Posted to microsoft.public.excel.programming
SMS SMS is offline
external usenet poster
 
Posts: 15
Default 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
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
Prevent event macro from executing on ALT-Enter John Keith Excel Programming 5 July 14th 09 03:42 PM
Prevent Corollary Event clara Excel Programming 1 May 9th 07 11:16 AM
Prevent automatic combobox event trigger [email protected] Excel Programming 0 March 9th 06 07:57 PM
prevent event procedure under condition short_n_curly Excel Programming 3 June 27th 05 08:38 PM
Prevent Change in Event when not needed JK Excel Programming 0 October 13th 03 08:10 PM


All times are GMT +1. The time now is 10:50 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"