insert listbox items into word table rows
Please I need help with some codes on populating word tables with data inside a listbox. The listbox has 3 columns, and I will like to add all data in the listbox into word table rows, without actually clicking any data row in the listbox. For example, I want the first row in the listbox to be the first row in the word table and so on.
the code that I thought was going to work only writes the last inserted data in the listbox into the word table after i click the add button. Is it possible for me to write all the data in the listbox into different rows of word table at the same time withouht actually multi-selecting the values?
here is the code:
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = ActiveDocument.Tables(12).Rows.Count - 1
For j = 0 To lstDescription.ListCount - 1
For k = 0 To lstDescription.ColumnCount
With .Rows(i + 1)
.Cells(1).Range.Text = lstDescription.List(j, 1)
.Cells(2).Range.Text = lstDescription.List(j, 1)
.Cells(3).Range.Text = lstDescription.List(j, 0)
I appreciate your kind help!