Hi All!

This is my first posting here (but I've long time reader/user of your expertise - thanks for that!) I hope someone out there has a solution for this, because I've tried everything I can think of, without any success.

Is there any way to tell if a table cell or row is marked for deletion (using MS Word 2010)?

I have several macros that run through all the tables in my document and do various things, like adding unique ID's in a blank cell of an added row.

The problem is that I don't want these macros to bother with rows (or cells) that are marked for deletion (with "Track Changes" that haven't been accepted yet).

So for example, say I have a table with 5 rows, where rows 3 and 5 are marked for deletion with track changes - I want my macros to affect only rows 1, 2, and 4. But to do that, I need some way of determining if a cell or row is marked for deletion (not the content in the cell or row).

In another posting here (titled Determining if a table has been deleted in Word), Macropod recommended testing for the existence of the "end of cell" or "end of row" markers - which I've tried, but without complete success.

Here is the code I've come up with (with thanks to Macropod!) Before I run it, I first have to cycle through every row to accept the changes to the content in .Cell(r, c), but then I lose the ability to see any changes that were made in that cell (prior to accepting them).

Thanks for any help!!!


Sub Tables_AutoNumber()
'PURPOSE: inserts an ID number in column 2 of each row (from row 2 to end) for each table, skipping any row marked for deletion

Dim t As Integer 'Table number
Dim r As Integer 'Row number
Dim n As Long 'ID number
Dim c As Integer 'Column number

n = 1 'Begining ID number
c = 2 'Column index where I want to place the ID

For t = 1 To 42
With ActiveDocument.Tables(t)
For r = 2 To .Rows.count 'Ignore row 1 / table header
On Error Resume Next
With .Cell(r, c)
'Debug.Print r; c; .range.Characters.Last.Revisions(.range.Revisions.count).Type
'Skip Rows/Cells that are marked as Deleted
If .range.Characters.Last.Revisions(.range.Characters.Last.Revisions.count).Ty pe <> wdRevisionDelete Then
'Make sure nothing is in this cell; 4 digits means there is already an ID there
If Len(.range.Text) < 4 Then
.range.Text = Format(n, "0000")
n = n + 1
End If
End If
End With
Next r
End With
Next t
MsgBox "Done!"
End Sub