nested table in WordI have a template which is essentially a 4-row column in Work. Each cell marked with a bookmark. I've copied a table from Excel to Word into one of these bookmarks (inside on of the cells). Now I'm trying to format this 'nested table' to make it fit according to my desired column widths (for certain columns) but I'm really struggling with the syntax. Additionally, in the table, the first row contains some merged cells (Some are merged to the cell in the adjacent column and some in the row below).
The code I was trying:
With wd.Tables(2)
.Columns(2).Width = 20
End With
But I keep getting "Run-time error '5941': The requested member of the collection does not exist." Does this mean I am not indexing it properly?
Tabels(2)
is meant to refer to the 'nested table' within the larger single column of 4 rows cells.
How do index it properly/find its index? And how would I change the widths when I have merged cells? Would I need to: divide them first>adjust width>re-merge? Also, I'm doing this in VBA Word, if I reference 'Microsoft Word xx.0 Object Library' in excel VBA can I do this in excel?
wd.Tables(1)
, the first Table in your Word document would bewd.Tables(0)
. – Jordanwd.Tables(1).Tables(1)
instead ofwd.Tables(2)
– LocEngineer