Quote:
Originally Posted by macropod
As written, the code checks whether it is exiting the last content control in the table. The number of content controls in that row is of no consequence. Indeed, the code was tested against tables having every possible kind of content control in a given row - including multiples of the same kind.
That said, it was not envisaged that the code would be run against a table having multiple content controls in the same cell. That could be accomodated by changing:
Code:
'Get our ContentControl's index # in the table
j = ActiveDocument.Range(.Range.Tables(1).Range.Start, .Range.End).ContentControls.Count
to:
Code:
'Get our ContentControl's index # in the table
j = ActiveDocument.Range(.Range.Tables(1).Range.Start, .Range.Cells(1).Range.Start).ContentControls.Count
j = j + ActiveDocument.Range(.Range.Cells(1).Range.Start, .Range.End).ContentControls.Count
|
Thanks macropod for your kind assistance.
I tried but it prompts the user to add new row at one of my content controls in a nested table contained within the last row/cell instead of the last content control. I think I may need to show you how my table looks like in order for you to help me see where the issue lies but I'm afraid it will take up too much of your time.
I forgot to mention that I also have a nested table within the last row/cell containing 3 content controls so it complicates things. But meanwhile, I will stick to using the quick access toolbar to add new row first as I have not encountered any errors with that!
Thanks a lot macropod.