Hi,
I have a word table name string in the form of txtTableName:
How can I convert this string to a Word.Table object so I can use this code from the ms website?
Any help of advice would be much appreciated
Thanks,
Roy
I have a word table name string in the form of txtTableName:
Code:
For a1 = 1 To tblCount ' count of word tables
txtTableName = "txtTable" & a1
If Form1.Controls(txtTableName).Value <> "" Then
'do stuff
End If
Next a1
How can I convert this string to a Word.Table object so I can use this code from the ms website?
Code:
Sub PopulateAndExtendTable(ByRef tbl As Word.Table, ByRef aData() As Variant)
Dim nrRows As Long, nrCols As Long
For nrRows = 1 To UBound(aData, 1) + 1
For nrCols = 1 To UBound(aData, 2) + 1
tbl.Cell(nrRows, nrCols).Range.Text = aData(nrRows - 1, nrCols - 1)
Next nrCols
If nrRows <= UBound(aData, 1) Then
tbl.Rows.Add
End If
Next nrRows
End Sub
Any help of advice would be much appreciated
Thanks,
Roy