MXD Doctor
This utility provides functionality to analyze broken ArcMap document (MXD) files. Depending on the analysis, entities contained within the broken MXD file can be copied from the broken file into a new MXD file.
This utility is provided as is. Before using this utility you should always back up the broken MXD file, and if you choose an existing MXD file as the target, that file as well.
How to use the MXD Doctor Utility
Displaying the interfaceLoading and Analyzing a Map Document
Previewing the Map Document
Generating a Diagnostic Report
Treating a Document
Copying PageLayout and Maps
Extracting VBA from ArcScene and ArcGlobe documents
The MXD Doctor is a standalone application. Run MXDDoctor.exe (found in the Tools folder of the ArcGIS Developer Kit). A warning dialog appears to remind you to back up your documents.
MXD Doctor can recover entities from the broken file to a new map document or to an existing map document. At this point you should backup the broken file, and if you propose to use an existing file as the target, backup the target file as well. To continue on to the main dialog, click Yes.
The main interface is a tabbed dialog. The only button enabled is Browse, which allows you to select the broken MXD file. Note the MXD Doctor, although intended for extracting valid entities from broken MXD files, can also be used to retrieve entities from valid MXD files, as a way of copying things from one MXD file to another.
Loading and Analyzing a Map Document
Select the broken MXD file using the Browse button. After you select the file, the filename is added in the text box next to the button, and the document is analyzed. The results of the analysis are shown in the Document Status frame. To perform this analysis, the broken document must have read / write file permissions.
The entities that are analyzed are:
- Maps Data Frames
- Page Layout
- VBA Project
- Style Gallery
- Thumbnail Preview
After the analysis, the check boxes for each of these entities will display the results using the following symbols.
![]() |
Recoverable |
![]() |
Recoverable, although not completely |
![]() |
Unable to determine status |
![]() |
Not recoverable |
![]() |
Not present |
As an example, the document status shown below indicates that the Page Layout is recoverable, however the maps within the layout are not. The style gallery is not recoverable (this is commonly caused when the document references a style gallery not on the machine). The thumbnail preview is good, and the status of the VBA project is undetermined. If no VBA code exists within the project the VBA project entity will be missing from the document this is not an error.
Using the preview options, it is possible to look at the contents of the broken MXD file to further assist you when deciding the entities to retrieve from the broken document. Only recoverable entities can be previewed.
The diagram below shows the MXD Doctor previewing map data.
If there is more that one map (data frame) in the document, the index combo box allows you to select which map to preview. The maps index and name are displayed in the combo box. Panning and zooming of maps and page layouts is supported. The thumbnail view can be viewed only.
Generating a Diagnostic Report
It is possible to generate a diagnostic report for all the entities contained within the broken MXD file. Click the Generate button to generate the report; the results are displayed in the Viewer frame, as shown below.
The contents of this report can be used to identify possibly bad entities. If required, the report can be saved to a text file or printed directly to the printer; click the Save or Print command.
Depending on the results of the analysis, it may be possible to recover entities from the broken document and copy them to a new or existing document.
When you move to the Treatment tab of the dialog, by default, a new document name will be selected in the Target MXD File text box. This indicates a new map document is to be created. The default is a document in the same folder as the broken document, with the same name appended by '_new'. You can specify a different new document, or choose an existing map document as the target. Fixing the document will attempt to copy all recoverable entities found in the broken document and place them in the target document.
Click the Fix Document button to proceed with the treatment. The progress of the treatment is shown in the text box on the right of the form.
If the 'Transfer all non broken' option is unchecked, you have control over what recoverable entities are copied from the broken document. These options fall into two main categories: Page Layout and Maps, and Miscellaneous. The miscellaneous items can be copied selectively, since they are not reliant on any other entities.
The Enable check box must be checked for any of the page layout and map options to be performed. The page layout and map entities are linked, and hence have four options, and perhaps restrictions depending on the analysis of the broken document. The options are:
- PageLayout and Valid Maps Copies page layout and all valid maps from broken document to the target MXD file. This option removes the existing page layout and the maps from the target MXD file.
- PageLayout and New Map Copies Page Layout minus data frames from the broken map document. A new blank data frame is added to the page layout. This option removes the existing page layout and the maps from the target MXD file.
- Only PageLayout Copies only the page layout from the broken MXD file, adding the data frames from the target MXD file to this page layout.
- Only Maps Copies the maps from the broken MXD file, and adds them to the page layout of the target MXD file.
Extracting VBA from ArcScene and ArcGlobe documents
Although not designed to handle SXD or 3DD files, the MXD Doctor can be used to extract the VBA project from a broken ArcScene (SXD) or ArcGlobe (3DD) document. This feature will only work if the target document already exists. Use ArcScene or ArcGlobe to create a blank target document before starting the MXD Doctor. In the MXD Doctor dialog, to specify the filenames of the source and target documents, you will need to use the Browse buttons, go to the correct folder then type the file name of the document, since the browser is intended for MXD and MXT files.




