How to fill ComboBox control of one document of values from thÕ table of other document?

A

avkokin

Hello.
There is one document with the table. All cells of the first column
has the field "ComboBox" control. And there is second document with
the table which has into all cells in first column some values.
I need to fill ComboBoxes first document these values from table of
second document. How?
Thank you very much.
 
J

Jean-Guy Marcil

avkokin said:
Hello.
There is one document with the table. All cells of the first column
has the field "ComboBox" control. And there is second document with
the table which has into all cells in first column some values.
I need to fill ComboBoxes first document these values from table of
second document. How?
Thank you very much.

What Word version?
What type of field Combobox? (Formfields, ActiveX, Content Controls - for
Word 2007?)
 
A

avkokin

What Word version?
Word 2003
What type of field Combobox? (Formfields, ActiveX, Content Controls - for Word 2007?)
It is Content Control - Combo Box.
Thank you.
 
D

Doug Robbins - Word MVP

Word 2003 does not have Content Controls. They were introduced with Word
2007.

From what Toolbar did you insert the controls - the Control Toolbox toolbar
or the Forms toolbar?

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

avkokin

From what Toolbar did you insert the controls - the Control Toolbox toolbar
or the Forms toolbar?

Sorry, I was meaned Control Toolbox, not Forms toolbar. Thank you.
 
D

Doug Robbins - Word MVP

Something like:

Private Sub Document_Open()
Dim Source As Document
Dim SourceTable As Table
Dim i As Long
Set Source = Documents.Open("Path\Filename")
Set SourceTable = Source.Tables(1)
With Me.ComboBox1
For i = 1 To SourceTable.Cell(1, 1).Range.Paragraphs.Count
.AddItem SourceTable.Cell(1, 1).Range.Paragraphs(i).Range.Text
Next i
End With
With Me.ComboBox2
For i = 1 To SourceTable.Cell(2, 1).Range.Paragraphs.Count
.AddItem SourceTable.Cell(2, 1).Range.Paragraphs(i).Range.Text
Next i
End With
'etc.
End Sub


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