D
dedawson
I have a table containing nested tables. I need to remove the nested
tables (replacing them with a placeholder), modify the parent table,
and then replace the nested tables.
In the first loop, I copy the table to the array, cut it from the doc,
and put in the placeholder.
In the second loop, I find the placeholder, and attempt to replace it
with the table from the array
I have no problem with any of this except getting the saved tables out
of the array and back into the doc. Here's hoping someone can turn on
a light bulb for me.
Dim TableRepository() As Variant
iEmbeddedTableCount = ActiveDocument.Tables(1).Tables().Count
ReDim TableRepository(iEmbeddedTableCount)
For i = iEmbeddedTableCount To 1 Step -1
ActiveDocument.Tables(1).Tables(i).Select
TableRepository(i) = Selection
Selection.Cut
Selection.TypeText Text:="TableRepository(" + str(i) + ")" + vbCrLf
Next i
Selection.Find.Wrap = wdFindContinue
For i = 1 To iEmbeddedTableCount
Selection.Find.Text = "TableRepository(" + str(i) + ")" + Chr(13)
Selection.Find.Execute
TableRepository(i).PasteAsNestedTable
' Selection.PasteAsNestedTable
Next i
End Sub ' SaveEmbeddedTables
thanks,
david
tables (replacing them with a placeholder), modify the parent table,
and then replace the nested tables.
In the first loop, I copy the table to the array, cut it from the doc,
and put in the placeholder.
In the second loop, I find the placeholder, and attempt to replace it
with the table from the array
I have no problem with any of this except getting the saved tables out
of the array and back into the doc. Here's hoping someone can turn on
a light bulb for me.
Dim TableRepository() As Variant
iEmbeddedTableCount = ActiveDocument.Tables(1).Tables().Count
ReDim TableRepository(iEmbeddedTableCount)
For i = iEmbeddedTableCount To 1 Step -1
ActiveDocument.Tables(1).Tables(i).Select
TableRepository(i) = Selection
Selection.Cut
Selection.TypeText Text:="TableRepository(" + str(i) + ")" + vbCrLf
Next i
Selection.Find.Wrap = wdFindContinue
For i = 1 To iEmbeddedTableCount
Selection.Find.Text = "TableRepository(" + str(i) + ")" + Chr(13)
Selection.Find.Execute
TableRepository(i).PasteAsNestedTable
' Selection.PasteAsNestedTable
Next i
End Sub ' SaveEmbeddedTables
thanks,
david