Text boxes being corrupted

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Text boxes being corrupted

Post by Peter Kinross »

Win 10, Word 2010.
Why does a text box with text in it similar to this:
With Zuver
You can use any of the following to configure email client by:
IP address: 111.333.148.220
Server host name: xyz.zuver.net.au
Mail domain name: mail.something.biz

change to:
50k¬ª›ARCîØ7ó DÚ»„^xO¯.ª%œ¡óc.~ÿv… €©k õ3â2Ï,ºùH•Ý"ùT:ÆI­À\«¸€ÐÑKm"ù
,Oe Ëw”婘øêmúŒ–ÆVCÉæXETö9$¤ÞW¥ò¶ËȪǏ~&Ÿ³¾(L®8<

The text box is in a large 13 page table. All text boxes in the table become corrupted in a similar fashion. I have re-built it a couple of times, but it still corrupts. Fortunately, I have a 10 month old version that has (so far) avoided corruption, so I can fix it. But I would sure like to avoid the corruption.
Avagr8day, regards, Peter

User avatar
macropod
4StarLounger
Posts: 508
Joined: 17 Dec 2010, 03:14

Re: Text boxes being corrupted

Post by macropod »

It's possible the document has acquired some of corruption. Corrupt documents can often be 'repaired' by inserting a new, empty, paragraph at the very end, copying everything except that new paragraph to a new document based on the same template (headers & footers may need to be copied separately), closing the old document and saving the new one over it. With a mailmerge main document, you'd also need to re-connect to the data source and re-apply any filtering.

Similarly, corrupt tables (which the above process won't repair) 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.

Do note that some forms of table corruption can only be repaired by the first method.

Code: Select all

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
I'm not sure how well any of the above will work with corrupt textboxes, but I do have to wonder why you'd be using them in tables.
Paul Edstein
[Fmr MS MVP - Word]

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Text boxes being corrupted

Post by Peter Kinross »

Thanks Paul . Sorry for the delayed reply, we have been away for Easter.
That looks like it might work, but it will be awhile before I have time to properly give it a go.
Text box in tables: Here is an example of why I need it. this is an altered [portion of the rogue doc. The doc is 17 pages long and only about 4 or 5 table rows have text boxes, the one below has been simplified, but is still the most complex of them all. You can see the stuffed up bits.
TxtBoxInTable.jpg
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter

User avatar
macropod
4StarLounger
Posts: 508
Joined: 17 Dec 2010, 03:14

Re: Text boxes being corrupted

Post by macropod »

Peter Kinross wrote:THere is an example of why I need it. this is an altered [portion of the rogue doc. The doc is 17 pages long and only about 4 or 5 table rows have text boxes, the one below has been simplified, but is still the most complex of them all. You can see the stuffed up bits.
For anyone to do anything meaningful, we'd probably need an actual document.
Paul Edstein
[Fmr MS MVP - Word]

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Text boxes being corrupted

Post by Peter Kinross »

It's possible the document has acquired some of corruption. Corrupt documents can often be 'repaired' by inserting a new, empty, paragraph at the very end, copying everything except that new paragraph to a new document based on the same template (headers & footers may need to be copied separately), closing the old document and saving the new one over it.
Macropod, I did the above, it seemed to work. I have now waited a month and it is still working.
Nothing short of Brilliant!
THANK YOU.
Avagr8day, regards, Peter

User avatar
Charles Kenyon
5StarLounger
Posts: 641
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Text boxes being corrupted

Post by Charles Kenyon »

Good that it is working.
Why textboxes rather than nested tables?

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Text boxes being corrupted

Post by Peter Kinross »

Thanks Charles,
The screenshot I posted above is a simplified version. See below for what it actually looks like. I don't think this could be replicated using tables within a table.
TextBoxesInTable.jpg
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter