Sanjeev Sabhlok's notes on technology, hardware, gardening

Entire text has disappeared in Microsoft Word, only footnotes are visible

This has happened twice. A solution below (it is pretty complicated but works).

1. What happens is that while updating the table (F9) one might accidentally press Alt-F9, and then select all text. This converts it all into a field.

2. How to undo this is impossible manually. It requires a MACRO.

3. See this first – how to install a macro in the Word document: https://www.gmayor.com/installing_macro.htm

4. Then install this macro:

Sub ExtractFieldCode()
    ' Jay Freedman
    ' https://answers.microsoft.com/en-us/msoffice/forum/all/code-field/5f5f839e-581b-4578-b446-391b635b4af3
    '
    Dim rg As range
    If ActiveDocument.Fields.Count = 0 Then
        MsgBox "This document contains no fields."
        Exit Sub
    End If
    With ActiveDocument
        .ActiveWindow.View.ShowFieldCodes = True
        .Fields(1).Code.Cut
        .range.PasteSpecial DataType:=WdPasteDataType.wdPasteHTML
        .ActiveWindow.View.ShowFieldCodes = False
    End With
End Sub

5. Now run the macro!

DONE – THE ORIGINAL TEXT WILL RETURN.

Note: it is possible that a few problems might emerge in the text that has been retrieved. I had a to manuall fix some of these problems, but it was far better than re-typing material that I had lost.

sabhlok

View more posts from this author

Leave a Reply

Your email address will not be published. Required fields are marked *