Last active
February 4, 2019 03:47
-
-
Save dhruva81/cb919389a535dcfdc5e00beefecb34fb to your computer and use it in GitHub Desktop.
Insert a New Row at Top/Bottom of Tables in MS Word using VBA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub insertTopRow() | |
| Dim theTable As Table | |
| Dim theNewRow As Row | |
| Dim i As Integer | |
| For i = 1 to ActiveDocument.Tables.Count | |
| Set theTable = ActiveDocument.Tables(i) | |
| Set theNewRow = theTable.Rows.Add(theTable.Rows.First) | |
| 'Other row formatting | |
| Next i | |
| End Sub | |
| Sub insertBottomRow() | |
| Dim theTable As Table | |
| Dim theNewRow As Row | |
| Dim i As Integer | |
| For i = 1 to ActiveDocument.Tables.Count | |
| Set theTable = ActiveDocument.Tables(i) | |
| Set theNewRow = theTable.Rows.Add | |
| 'Other row formatting | |
| Next i | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment