Firing Event in another user form

W

wilson9783

I have a textbox in a UserForm where I add a string and when the entry is complete the After_Update event fires.

' In UserForm1
Private Sub TextBox1_AfterUpdate()
MsgBox "After Update"
' Do stuff here
End Sub

What I'm trying to accomplish is to open a second UserForm so that I can search in a ListBox for the proper string to place in that original TextBox.

' From UserForm2
Private Sub CommandButton1_Click()
Unload Me
UserForm1.TextBox1 = Label1.Caption ' Populate TextBox1 with this result
End Sub

All works well with getting the TextBox populated with what I need to but I can't get the After_Update event to fire.

Thanks in advance for your help.

John
 
B

Bob Flanagan

I have a textbox in a UserForm where I add a string and when the entry is complete the After_Update event fires.



' In UserForm1

Private Sub TextBox1_AfterUpdate()

MsgBox "After Update"

' Do stuff here

End Sub



What I'm trying to accomplish is to open a second UserForm so that I can search in a ListBox for the proper string to place in that original TextBox.



' From UserForm2

Private Sub CommandButton1_Click()

Unload Me

UserForm1.TextBox1 = Label1.Caption ' Populate TextBox1 with this result

End Sub



All works well with getting the TextBox populated with what I need to but I can't get the After_Update event to fire.



Thanks in advance for your help.



John

The after event in forms is text boxes is un-reliable. Instead, have the user press a command button and have it do the actions you want.

Robert Flanagan
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top