“Enter” event triggers at the wrong time

Glory

Well-known Member
Joined
Mar 16, 2011
Messages
640
I’m working with a userform. I’ve got a text box on a multipage object. When I enter the multipage object, the enter event for the text box is triggered. Is there a way to stop this from happening?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello Glory,

The Enter event on a UserForm can not be disabled like events in Excel. Without seeing your code, I am guessing you need to move the code from the TextBox_Enter event (default event) to some more appropriate event like the TextBox_Click or TextBox_AfterUpdate event. Which event to use would depend on what you want to accomplish.

Sincerely,
Leith Ross
 
Upvote 0
Change the TabStop property of the TextBox to False, or if there is another object on the same page as the TextBox, make the TabIndex property for the TextBox greater than 0

It seems that when the Page is selected, the object on that Page with a TabIndex of zero is also automatically selected.
 
Upvote 0
<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:place w:st="on">Leith</st1:place>: The code clears the textbox if it's set to its default value. An exit event resets the default value if the textbox is still empty when the field loses focus.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
The enter event is the one I'm going to have to stick with, I think. Part of the idea is that I want to be able to tab into the field (so no click event), and the code would not work with a change event. Thanks for the reply, though.<o:p></o:p>
<o:p></o:p>
AlphaFrog; Your response, as usual, is highly instructive. <o:p></o:p>
<o:p> </o:p>
I'm not going to set the tabstop property to false because I want to be able to tab into the field. I'll remember what you said about the tabindex property and its buggy effect on selection, although this time it happens to be greater than zero.<o:p></o:p>
<o:p></o:p>
I closed without saving by mistake, and when I reopened the workbook the problem vanished. I can now click my multipage without causing the text in the textbox to clear.<o:p></o:p>
<o:p></o:p>
Mysteries never cease.<o:p></o:p>
<o:p></o:p>
All that being said, I do have two other questions on my mind tonight (one of which is making it particularly difficult to do my work the way I want to do it). If either of you feel like taking a swing:<o:p></o:p>
<o:p></o:p>
1) I can't target pivot tables through VBA except on inactive sheets<o:p></o:p>
<o:p></o:p>
2) I can't create a working tabstrip<o:p></o:p>
 
Upvote 0
Hello Glory,

Glad to hear you got it working. I am going to pass on the new questions as it is getting late here in California.

Sincerely,
Leith Ross
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top