Whenever I update the document, I need to add a row to the top of the table, just below the headers, and then move the old row to the next level. The table is usually present on the last page of the Word document. Please find attached the screenshot for the expected and actual behaviors. Below is the code I have written to achieve:
- Go to the last page and find the table
- Add a row (This adds above the column header)
Expectations:
- Add the row immediately after the column header and move the existing row to the next level
- Add the date to the second column. Click for the screenshot
My code:
Sub Macro1()
Selection.EndKey Unit:=wdStory
Dim theTable As Table
Dim theNewRow As Row
For Each theTable In ActiveDocument.Tables
Set theNewRow = theTable.Rows.Add(theTable.Rows.First)
'Other row formatting
Next theTable
End Sub
I am learning VBA and any help would be of great use. Thanks for your time.