Pass ListBox Values into TextBox1 Field

J

joesmithf1

Ok...I have a MS Words form. I created a textbox in this form.

The other thing that I have is a "UserForm" with a listbox.

When an user select any one value from this listbox, I want that value to
populate the "textbox".

Here are my codes(in UserForm):
Private Sub CommandButton1_Click()
ActiveDocument.FormFields("TextBox1").Result = Me.ListBox1.Text
Unload Me
End Sub

WHen I run this, I get an '5941' error message. Please advise what I am
doing wrong.

Thank you.
Joe
 
D

Doug Robbins - Word MVP

Using

ActiveDocument.FormFields("TextBox1").Result = ListBox1.Value

will set the .Result of the TextBox1 formfield to the value of the item that
is in the BoundColumn of the currently selected item in the ListBox1
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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