Bruno
This macro borrows the save/reopen technique that Shauna suggests here
but does so for each table in the document. For not many tables,
Shauna's method has to be faster; for a whole lot of tables and/or
multiple corrupt tables, this one's probably easier.
It cycles through each table in the document. When it finds a corrupt
one (with your help) it applies double strikethrough to the table so
you can see it. Then you go back and reconstruct or re-do the
offending table(s).
* First save a blank doc as "TestTables.doc" and put it in the
same folder as your original doc. If you're on a network, it may mean
putting both of them on the C:\ drive temporarily.
* Then paste this macro into your original doc (not into
Normal.dot). Use these steps:
1) Copy the code below from the thread
2) On your original doc, Alt-F8
3) In Macros box, select the original doc name
4) In the Macro name box, type in "TestTables"
5) Click Create, which takes you straight into the code editor
6) Paste this code into the editor between Sub TestTables () and End
Sub
7) Where you get two red lines, put them back together into one line
with an extra space where the line break was
8) To run the macro, Alt-F8, select "TestTables", click Run
* No guarantees here because I had no corrupt tables to test
with.
* Would appreciate it if someone with corrupt tables tested it and
came back to let us know if it works or not.
Dim T As Table, Cnt As Integer, Ans As Byte, TCnt As Integer
TCnt = ActiveDocument.Tables.Count
For Each T In ActiveDocument.Tables
Application.ScreenUpdating = False
Cnt = Cnt + 1
T.Range.Copy
Documents.Open "TestTables.doc"
ActiveDocument.Content = ""
Selection.PasteAndFormat (wdPasteDefault)
ActiveDocument.Save
ActiveWindow.Close
Documents.Open "TestTables.doc"
Application.ScreenUpdating = True
Application.ScreenRefresh
Ans = MsgBox("Is table #" & Cnt & " corrupt?", vbYesNoCancel, _
"Table #" & Cnt & " of " & TCnt)
If Ans = 2 Then
MsgBox "Quitting."
ActiveWindow.Close wdDoNotSaveChanges
Exit Sub
End If
Application.ScreenUpdating = False
ActiveWindow.Close
If Ans = 6 Then
T.Range.Font.DoubleStrikeThrough = True
End If
Next
If you want to replace the DoubleStrikeThrough with a color or a
highlight, you could record a simple macro that changed the color of
selected text, then plop that code into the third line from the
bottom. Instead of 'Selection.Font' use 'T.Range.Font' as you see
above.