Missing ComboBox Combination

W

Wanna Learn

Hello
I have a User form created is VBA
I have a combo box and it does not work below are all the codes for this
combobox

Private Sub ComboBox2_Change()
' enter value to unload combo box 2
ActiveDocument.FormFields("Text84").Result = ComboBox2.Value

Private Sub UserForm_Initialize()

ComboBox1.ColumnCount = 1

'Load data into ComboBox

ComboBox1.List() = Array("offer", "renew")
ComboBox2.List() = Array("New", "Expired", "Scheduled to Expire")
ComboBox3.List() = Array("Pricing Specialist", "Senior Pricing Specialist")
End Sub

Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks("Text71").Range _
.InsertBefore TextBox1
.Bookmarks("Text72").Range _
.InsertBefore TextBox2
.Bookmarks("Text84").Range _
.InsertBefore ComboBox2
.End With

UserForm1.Hide

When I test the form and I get to the comboBox2 and I select an option I get
the error message
Run-Time error "5941':
The requested member of the collection does not exist.

when I click debug the following is highlighted

Private Sub ComboBox2_Change()
' enter value to unload combo box 2
ActiveDocument.FormFields("Text84").Result = ComboBox2.Value

Please How do I correct this? I have tried to no avail thanks
 
D

Doug Robbins - Word MVP

It probably means that the bookmark Text84 does not exist in the document.

Also, in that you are using the command button to insert the data into the
document, why do you have the combobox change event?

I would be saving the data in document variables and having it displayed in
the document by the use of DOCVARIABLE fields.

--
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
 
W

Wanna Learn

Thanks Doug Robbins
This is very helpful...
I'm new at creating user forms . Can you tell how to save the data in
document variables and having it displayed in
the document by the use of DOCVARIABLE fields? or where I can get information on how to do it
thank you
 

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