Hi,
I have a MS Words form. I created a textbox in this form.

The other thing that I have is a popup "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:
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

Hi,
I Think "TextBox1" may not exist in the FormFields Collection. Check TextBox1 is correct. I think check the BookMark Property of control.

To Find the Name i give code that shows all the FormFields Items name.

Dim obj As FormField

For Each obj In ActiveDocument.FormFields
    MsgBox obj.Name
Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.