I'm trying to learn how to handle Range objects in Word VBA with regards to MS Word tables.
Using the Range object help, it would seem I can create a range of cells as long as the cells are contiguous, however I cannot seem to get the syntax for specifying the Start and End points of the range using cells.
For example:
Set rngCells = myTable.Range(Start:=<cell>, End:=<cell>)
I'm not sure what to put in for to indicate the cell to start or the cell to end with. Can someone give me a clue? :)
Edit: I've already created the table from scratch -- I'm trying to use a range of cells for some of the rows in the middle to apply formatting to them. In particular, I'm trying to see if this can be done without using Selection.
I found the answer I was looking for:
Set myCells = ActiveDocument.Range(Start:=ActiveDocument.Tables(1).Cell(1, 1).Range.Start, _
End:=ActiveDocument.Tables(1).Cell(1, 1).Range.End)
I did not realize the Range object was from the Document object, not the Table object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With