views:

1192

answers:

1

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.

A: 

I found the answer I was looking for:

Set myCells = ActiveDocument.Range(Start:=.Tables(1).Cell(1, 1).Range.Start, End:=.Tables(1).Cell(1, 4).Range.End

I did not realize the Range object was from the Document object, not the Table object.

romandas