How to recover a Master Document

Article contributed by John McGhie

  1. Overview  [ Versions of Word
  2. Why Master Documents corrupt ...
  3. And how to recover them [ Software PatchesScan for Viruses /   Create a Template /   Create a base document / Copy text  / Formatting
  4. Obtaining patches
  5. Creating a template
  6. Creating a base document
  7. Copying text
  8. Repairing formatting

Note that this procedure must be followed in strict sequence in order for it to work.

1.

Overview

Notice how this article starts off with the cheerful assumption that you want to recover a Master Document? I bet you were hoping that we would tell you how to fix one! We can't. If you are having a problem with a master document, the problem is the master document. Any attempt you make to repair one will inevitably make your problem worse.

Do not be tempted to re-create a master document. If you re-create the master document, you will immediately re-create the problem. Master documents have been fatally buggy since Word 6, and remain so through Word 2000. If you use them you lose them. They must never be used for valuable text.

There is no way to successfully and safely use master documents. They always corrupt eventually.

To understand why, you need to understand the Microsoft Word document internal structure in some detail.

Versions of Word
The Master Document feature appeared first in Word 6 for Windows. These instructions are written for Word 97 and above. The master document bug afflicts those products to a much greater degree, due to their more complex internal file format.

2.

Why Master Documents corrupt ...

For information on why they corrupt, please see the article Why Master Documents corrupt .

3.

And how to recover them

I strongly recommend that you read through this whole article first, before you attempt any of it. The procedure is long and potentially confusing. The command and menu names come from Word 2000. You may have to apply a little interpretation, particularly if you are working in a language other than English.

Please bear in mind that this procedure recommends that you do particular, specific actions in a tightly defined sequence using specific methods. That's because I have found that it works that way (and in many cases I found out the hard way that it doesn't work any other way). It is very tempting (particularly for me) to read such a procedure and say I know all about Word, I don't need to follow all that! Allow me to gently suggest that if you did, you wouldn't be here {grin}.

Software Patches
Microsoft issues service releases for its major software about twice a year. The first one contains fixes to many of the issues that were discovered during beta testing. Between service releases, Microsoft may release one or more patches or fixes.

If you use the default numbering and bulleting buttons on the Formatting toolbar, then for Word 97 and 2000, one of the more important fixes is for the build-up of unwanted list templates. See Microsoft Knowledge Base articles Q237274 and Q241581 (Error Message: This Document May Be Corrupt After Switching Between Bullet and Number List Format). This fix is included in Word 2002 as standard.

Unfortunately, though, the fix does not work unless the user opens a document contains so many list templates that without the fix, they would get the This Document May Be Corrupt message (more than 1500 list templates). However, documents containing anything over 100 list templates are prone to other forms of document corruption. And in any case, the vast majority of document corruptions are not specifically list template related.

Bugs that have been corrected in the service releases or patches may have caused the problems you are having. If your software is not at the latest service level, there is little point in reading any further: it is more likely than not that your problem will simply re-create itself as soon as you save the document.

To obtain the patches, see Obtaining Patches , below.

Scan for Viruses
So often, the cause of a document corruption is one of the myriad Word macro viruses floating around the world.

Ensure that you download the latest anti-virus definitions from your anti-virus vendor and scan your whole machine. Definitions more than a month old are too old, and you need to ensure you have your virus scanner configured for a deep scan.

Create a Template
All the initial settings for a document and its styles are held in a file called a Template. If you do not understand templates, read About templates in the Word Help.

Document corruptions often begin in, or are copied to, the template the document is attached to.

The template that is most likely to corrupt is the default global template, Normal.dot. We need to create a new, known good template to work with. Until we do, we are likely to get the problem back at any instant, whenever the corrupt template is accessed (which can happen dozens of times during an editing session).

To create a template, see Creating a template , below.

Create a base document
The first thing you need to do is re-create your whole file as a single long document.

Because the master document file format itself is unstable, unless you re-create your file as a single document, the problem you have will simply re-occur.

To create a base file see Creating a base document , below..

Copy Text
Copying the text from your corrupt documents into your base document must be done very deliberately, with the utmost attention to detail.

Think of your problem as a virus (because it will behave a bit like one). It is an infected piece of code, sitting there in your file. Every time you access that piece of code, the infection will spread a little further.

You need to copy the text extremely carefully to ensure that you do not also copy the corruption into the new document. To copy the text, see Copying text , below.

Formatting
While it is true that your troubles have been caused by a bug in Word, the reason the bug bit is because of the way you used Word.

When you begin working on long, complex documents, all the rules change. Normally, Word is very, very forgiving. There are 45 ways to skin any given cat, and one way is as good as any other, so Word invites you to use the way that suits you.

This is not true in long document work. There are very definite rules for what you can and cannot do. If you break the rules, you break your document. See Repairing Formatting , below.

4.

Obtaining patches

First, determine whether your software is at the latest level.  If you open the Help menu in any Microsoft Office product, you will see an About item on the menu.  If you are using Office 2000 with Adaptive Menus, you may have to pause on the Help menu for several seconds until the About item is revealed.

Open this item.  A dialog box appears.  The top line of text in that dialog box provides the official product description for the software.

The end of the line contains some characters that tell you what service release you have.

It is not possible  for anyone to solve your problem until you have the latest service release.

5.

Creating a template

1.

Close all the documents and reboot (We need a nice clean computer without any dead bits of Word to interfere with things.

2.

Make sure you do not have anything else running for this exercise except your virus scanner. Close your email program (particularly: we don't want anything trying to talk to Word while we're doing this) and any other applications.

3.

Find and re-name your Normal.dot file. This is often deeply buried in your user profile. To find it, look in Tools>Options>File Locations. If you attempt to Modify the User Template location, the File Location you see when the dialog box opens is where your Normal.dot is. For god's sake do not change the location! Write the whole path down, cancel all the way out, stop Word, navigate to the location in Windows Explorer and re-name the file. Leave Explorer open where it is, you will need to come back here. You cannot rename the file if Word is running. It does not matter what you name the file: I usually add a single letter to the front of the file name: onormal.dot.

4.

Re-start Word. When it completes starting, stop it again. Word performs a check on startup to ensure it can find its normal.dot. If it cannot, it creates a new, blank default normal.dot. The file it leaves you when it exits is an absolutely perfect template: they do not get any more pure than this.

5.

Make a copy of this file and give it any name you like. Let's call it project.dot. We now have two files that are known good and guaranteed perfect in the directory.

6.

Re-start Word and use File>Open to open Project.dot. Look in the Title Bar of Word. Do you see Project.DOT displayed? You don't, huh? You've got Document2, haven't you? You opened the file out of Explorer by double-clicking, didn't you? Let that be a lesson to you as to the level of nit-picking detail with which you have to follow this procedure, or it won't work {big grin}. Throw that document away and go back and open project.dot using File>Open! Alternatively, you can right-click on Project.dot in Windows Explorer and select Open – that opens the template rather than creating a new document based on it.

7.

Use File>Page Setup to set your correct paper size, layout, and margins. Work slowly and patiently. Every project document you create will inherit these settings, so get them right. It's a matter of personal preference, but I would not put headers and footers in just yet. Let's find out if this is going to recover your document before we add the nice-to-have's.

8.

Now, go to Format>Style>Organizer and click the Styles tab. In the right-hand column of that dialog box you will see the styles for Normal.dot displayed (there should only be four at the moment). Disregard this and click the Close button below the right-hand-column. We do not want to do anything with Normal.dot. The Close button turns into an Open File button. Click it.

9.

Navigate your way to the best of your sub-documents. Make very sure it is not the master document you are looking at. This is critical: we must be very sure that we are not about to open the master document. Open the subdocument's style list.

10.

Copy all the styles into your new project.dot file except the ones whose names begin with Heading. Say yes to all if you get prompted to overwrite. Click Close to this dialog box when done. This is called an organizer copy, and it is the only 100 per cent safe way to copy styles from one document to another. The nine Heading styles are built-in to every Word document. You won't see them in the list until they are used in a document, but they are part of the document structure, so we do not want to add them. It is possible that one of them actually contains the corruption.

Now we need to fix the List Templates. Open the Format>Bullets and Numbering menu.

1.

Go first to the Bulleted tab. Click in each of the offered samples and click the Reset button for each. Work your way through the whole list.

2.

Repeat this operation on the Numbered, and Outline Numbered tabs. Again, click in each of the offered samples and click the Reset button for each. Work your way through the whole list on both tabs.

3.

Click Cancel to leave this dialog box. What we have done here is to set all the numbering list templates back to their factory defaults. In Word 97 and above, bullets and numbering are the same thing. A corruption in this mechanism is the most likely source of your master document woes.

4.

Save and close the template. Exit Word and re-start it. We do this to force a write back to your registry. For some unbelievable reason (I know the reason, but it's just too silly to mention...) Word stores its bullets and numbering specifications in your user registry. This is why your numbering breaks whenever someone logged in as a different user opens your documents, even on the same computer. This is the subject of another FAQ ...

5.

We now have a new, dependable template, in a known good condition, with the same style settings as your master document had. The only possible differences can come if you ignored Word's warning that all the subdocuments of a master document must have the same template attached. If they didn't, Word should have imposed it. If this causes a problem, you can sort it out after you fix the formatting at the end of the procedure. If you try now, you will probably break your new template.

6.

Creating a base document

Next we create a new, blank document from the new template you just created.

Do it this way:

1.

Select File>New and choose Project.dot as your template.

2.

You will be rewarded with a new blank document. Let's call this file New Document hereafter.

3.

Go to Tools>Options>Save and ensure that you have Fast Saves turned OFF. Check Always make backup is ON at the same time.

4.

Go to Tools>Track Changes>Highlight Changes and ensure that Track changes while editing is turned off.

5.

Give New Document a name (must be a new name, do not save over an existing document) and save it. You must not write over the existing documents: you may have to repeat one or more of these procedures more than once; and you will need your originals when you've finished.

6.

Make sure you save to a directory where you have plenty of space: this thing is going to get quite large. Just a word about floppies (diskettes to those of us from IBM...). We do not save Word documents to removable storage. Not ever! If you need a document on a removable disk, close Word and copy the file using Explorer. A floppy is simply not large enough or reliable enough to contain a Word document. This has to do with the streaming format Word uses to write files to disk. If you use floppies, you break documents. So don't.

7.

Copying text

Now follow the following procedure (exactly) for each subdocument:

1.

Open each document or sub-document, one at a time.

2.

Make sure the paragraph marks are displayed. Use Tools>Options>View to display them if needed: it is essential that you can see the paragraph marks.

3.

Remove all the Section Breaks from the document. Search for ^b and replace with nothing. Note the b must be lowercase and the caret ^ is required. Most document corruptions are contained in Section Breaks: you must remove them.

4.

Remove all your direct formatting: Select all of the text with Ctrl + A, then remove all paragraph formatting with Ctrl + Q and all character formatting with Ctrl + spacebar. Your document may start to look quite peculiar at this stage: do not worry about it, and don't try to fix it now.

5.

Select all the text from the top of the document down to but not including the final paragraph mark and copy it to the clipboard. The bottom paragraph mark in a document hides the default Section Break, which is probably what contains the problem. If you copy the last paragraph mark, you will copy your problem.

6.

Close the subdocument without saving. You do not want to save the changes you have just made back to your original. Close the document, and when prompted to save, say no.

7.

Open New Document and paste the text you have copied into its correct position (normally, at the end).

8.

Save New Document, and do not attempt any fixing at this stage. You save between each operation because you may encounter a serious corruption in one of the files you open. If you do, Word will crash without warning, and you will lose everything you haven't saved.

9.

Repeat these steps until you have copied all the text from all the components into New Document.

8.

Repairing formatting

Do not attempt any fixing of any of the text until you have all the text assembled in New Document. If your PC is correctly configured, Word 97/2000 will easily handle a document up to about 1,000 pages, so do not worry: it will slow down a bit but it won't break.

Now you begin the fixing process. Do it in this order or you will end up chasing your tail:

1.

Replace the Section Breaks using Insert>Break. You still have your originals so you can search for them to see where they should go. But remember, the Section Breaks probably contain the problem: if copy any Section Breaks by mistake, you probably get to start over from the creation of New Document {grin}.

2.

When replacing the Section Breaks, you should probably leave out most of the breaks you find in the original master document. In a master document, each subdocument is surrounded by two extra encapsulating Section Breaks that are needed only in the master document: they should not be used in New Document. The fewer Section Breaks you end up with, the more reliable your result will be.

3.

Now unify the styles. First go through and re-name/re-apply misnamed styles. Often where unskilled authors have attacked a document, you will find that styles have been applied at random, and that there are several versions of each style. For example: You may find a text style, a Text style, a body-text style, a Body-Text style and a body text style. Careful inspection of the document will show that they are all actually the same thing, created by different authors, in different source documents.

4.

Before you can sort out your styles, you need to pick one name (doesn't matter which one, but your life will be easier of you pick the Word built-in style name) and use Find/Replace to apply that to the paragraphs that have the other named styles. When using Find/Replace, make sure you do not have any text in the Find What or Replace With boxes. Click the More button to reveal the Search Options, and on the Format button choose the Style option.

5.

You must now delete the duplicate styles from both the document and its template (otherwise in a months time, you will have random styles again...) I suggest you use Organizer to do this: it is easier to see what you are doing, and it is the only way of deleting styles reliably from the template. Note that Word will not permit you to delete built-in styles (which is why I suggested that you use those...).

6.

Now you need to correct the formatting of each style. You use Format>Style to alter the properties of each style so that the document is correctly formatted. Some hints:

a)

Make sure you check the Add to template box for each style, or your changes will not be saved.

b)

Make sure none of your styles are Based On Normal style. Correct any that are. Base your headings on the heading level above and your text styles on Body Text. I normally leave Normal Style orphaned so that wherever it is used in the document I can tell that I am looking at text that has not been formatted yet.

c)

Make sure that all the automatic formatting options remain turned off. Make sure that you also disable Fast Saves and check Always Make Backup. Make sure you disable Automatically Update on all your styles. If your document contains numbering, you must also disable Automatically Update Styles on Open when you attach the template.

Now, you need to put the numbering right. Here's the procedure. This procedure fixes Heading Numbering that displays out-of-sequence numbering. It does NOT fix any other kind of bad numbering.

If you omit any of these steps or fail to perform any, the procedure may not work. So unless you *really are sure* that you do not need to perform a step, do it anyway :)

1.

Go back to Tools>Track Changes>Accept or Reject Changes and click either Accept All or Reject All.

2.

Click in the first paragraph in the document that has the Heading 1 style applied. If there is no such paragraph, create one.

3.

Go to Format>Bullets and Numbering>Outline Numbered and click none.

4.

Save and close the document. When you save the document with Fast Saves turned off, you cause Word to clean out of the document all the previous editing changes. With Fast Saves on, these remain in the text where they do embarrassing things like let your customer read all the previous versions of a contract, or store corruptions. Furthermore, normally when you make a change to a document, Word simply marks the changed bits as superseded and leaves them in the document, in case you want to undo the change. When you close the document, Word discards the Undo List. In this case, the problem you are having would be saved one way or another: we want to force Word to clean the file up.

If you skip the close at this point, chances are the whole procedure won't work :)

5.

Re-open the document and click in the first Heading 1 paragraph in the document again. We do this operation always from the first Heading 1 paragraph because that is the beginning of the list. If we start with a lower-order paragraph like Heading 3, we run the risk that we might create two independent lists of numbers in the document, which is actually what our problem usually was in the first place.

6.

Go to Format>Style>Modify>Format>Numbering> Outline Numbered and choose the appropriate numbering format. Notice that we came into the dialog a different way this time? Numbering is a hell of a lot more stable if it is applied as part of a style, and that's what we are doing this time. If you have correctly reset your registry, one of the formats shows the word Heading in its sample. This is a critical step: only the samples that show the word Heading will actually do Heading numbering. The other samples simply won't do it. You can force them to try if you customise them within an inch of their lives, but you run the risk of corrupting the document if you do. This risk approaches certainty unless you understand Lists, List Templates, List Galleries and Styles almost perfectly.

7.

If it is possible to fix that document's numbering, you just have. Anything else wrong with the document is either not a numbering problem, or the document is beyond repair (which is not an unusual condition if you have been trying to fix it for a while).

8.

You now need to scan through the document and make sure that every Heading is correct. A very quick way to do this is to go into Outline View and click the black number 7 button, so you only see the headings without the text. Bad numbering will then leap out at you.

9.

You should also scroll through the document in Page Layout view after this. If users have made multiple attempts to fix the numbering, they may have resorted to manually typing heading numbers. You need to scan for these and replace them by applying the correct style to such paragraphs.

10.

Now, take a backup copy of your document and put it in a different folder. This is your baseline that you can come back to if the document falls to bits again. If the document was very corrupt, the above procedure may not have completely fixed it (and short of saving to Word 2 format, there is no way to do so). In which case the corruption may recur.

11.

Finally, you can customise the numbering format to your standard. Notice I said the numbering format. If you apply a different numbering format to the headings, you may find yourself back at Step 1 again {grin}.