![]() |
#4
|
||||
|
||||
![]()
That suggests the document has one or more corrupt tables. Corrupt tables can often be 'repaired' by:
• converting the tables to text and back again; • cutting & pasting them to another document that you save the document in RTF format, which you then close then re-open before copying them back to the source document; or • saving the document in RTF format, closing the document then re-opening it and re-saving in the doc(x) format – or see the macro below: Code:
Sub TableRepair() 'Macro to repair damaged tables by saving each table in an RTF-format file, then ' reinserting the table from the RTF-format file into the source document. Application.ScreenUpdating = False Dim Rng As Range, i As Long, RTFDoc As Document, strPath As String With ActiveDocument strPath = .Path & "\" For i = .Tables.Count To 1 Step -1 Set Rng = .Tables(i).Range Set RTFDoc = Documents.Add(Visible:=False) With RTFDoc .Range.FormattedText = Rng.FormattedText .SaveAs2 FileName:="strPath & RTFDoc.RTF", Fileformat:=wdFormatRTF, AddToRecentFiles:=False .Close End With Set RTFDoc = Documents.Open(FileName:="strPath & RTFDoc.RTF", AddToRecentFiles:=False, Visible:=False) Rng.Tables(1).Delete With RTFDoc Rng.FormattedText = .Tables(1).Range.FormattedText .Close End With Kill "strPath & RTFDoc.RTF" Next End With Set Rng = Nothing: Set RTFDoc = Nothing Application.ScreenUpdating = True End Sub For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
staicumihai | Word VBA | 14 | 11-15-2016 01:42 AM |
Cannot open docx in word 2016 | lakshi | Word | 1 | 08-24-2016 04:54 AM |
![]() |
mstratil | Word | 7 | 12-25-2015 03:27 PM |
![]() |
Duke | Word | 5 | 07-31-2015 08:30 AM |
Open DOCX in Word 2007 & Open DOC in Word 2003 | wilde_37 | Office | 0 | 02-03-2009 12:37 AM |