10/23/08

Office Word Crashes

I've tried several different places to try to resolve my Microsoft Word crashing and this site was the most resourceful.

Known problems Link


The Fix with help from tech support forum

What to do when Word crashes?
Such is the nature of the beast that sooner or later Word will crash. When you restart, Word may try and recover the document you were working on, but this is a bit hit and miss, so don't rely on it. Configure Word to create a backup file - and save often. It is good practice to drill CTRL+S into your brain and apply it every time you pause for thought. Then when the wheel comes off, you don't lose too much work.




While in the above dialog box - make sure that Allow fast saves is unchecked, as this is a major source of document bloat and corruption. As a bloated document will actually take longer to save, the function is effectively useless.

Word 2007




Fast saves has been dropped, but check the following



If even this is too much like hard work, there is a utility supplied with Word, or available for download from http://office.microsoft.com/downloads/2000/supmacros.aspx in the shape of the Save Reminder add-in. This is configurable not only to remind you to save, but you can set it to perform the save at predetermined intervals.



Temporary files
When Word is opened, Word creates an assortment of hidden temporary files, in various locations on the hard drive. Open a document and more are created. Edit the document and there are even more. In the normal course of events, these files are closed when they are no longer required, but if Word crashes and is unable to recover, they may be left behind, where they can cause havoc, and in a worse case, prevent you from re-opening your document - even from re-starting Word.

Much of this heartache can be avoided, if, following such a crash, measures are taken to put things right.

Before restarting Word!
Using Windows Explorer, the first place to look is the Windows temp folder, the location of which will be determined by the operating system, but is likely to be either C:\Windows\Temp or Drive:\Documents and Settings\\Local Settings\Temp.

But first it will be necessary to configure Explorer to display hidden files and the extensions of know file types (Tools > Folder Options) The illustrations below are from Windows 2000, but Windows XP is similar:



You can safely delete everything in this folder. Windows will not allow you to delete anything actually in use; however if Windows has locked the files, and certainly with Windows 95/98, you must reboot first to free the locked files. Given that the crash may have left the machine in an unstable condition, this is not a bad plan in any case.



Next step is to find the remaining problem files and delete them. To this end Explorer's search function will locate them all.




The files (including those for Word 2007) all fall in the pattern ~$*.do* so these are the strings to search for.





Temporary files are usually hidden so click the Advanced options and select the option to search hidden files.





Run the search and delete any files found.



Repeat the search limiting it to the locations where you store your Word documents, by default the My Documents folder, and any sub folders that you may have created, for files named *.tmp. It is possible to search for both types of file in a single search, by searching for "~$*.do*" OR "*.tmp" but this extends the search to files that have nothing to do with Word, so while ultimately all temporary files are as their name implies - temporary - we can leave the others for the purpose of this exercise.

Use a DOS batch file to collate the above actions to a single keystroke

DOS commands have largely been lost to folklore, but you can eliminate the temporary files by means of a simple DOS batch file called from a Windows shortcut.

Identify the user template, add-in, user temp and document folder locations:

In the following example from my own PC these are:

D:\Templates
D:\Word Startup
C:\Program Files\Microsoft Office\Office11\Startup
C:\Program Files\TechSmith\SnagIt 8
D:\My Documents
C:\Documents and Settings\Graham Mayor\Local Settings\Temp

Warning: Your folder locations will certainly be different - SO CHECK - as DOS commands have none of the safety checks available in Windows!!!


The first two are configured from Word > Tools > Options > File Locations. The third is dependent on the version of Office - here Office 2003. The fourth is configured in the Windows registry at:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

and is normally the Word default document folder. The last is dependent on Windows version.

The batch file opens each folder in turn, sets the file attributes to unhidden, where required, and deletes the orphaned temporary files.

Long folder names will not work in all versions of Windows, but the following batch commands will work in Windows XP.

Using Notepad or a preferred text editor, enter the following - changing the drive letters and folder paths to match the locations of the template and add-in folders. The REM lines are only descriptive and are ignored when the batch file is run.

REM Select the D: drive
D:
REM Select My Documents as the active folder
CD \My Documents
REM Delete orphaned hidden temporary files from My Documents and its sub folders
DEL /S /A:h ~$*.do*
DEL /S /A:h *.tmp

REM Select User Templates folder
CD \Templates
REM Delete orphaned hidden temporary files
DEL /A:h ~$*.do*

REM Select Word startup folder
CD \Word Startup
REM Delete orphaned hidden temporary files
DEL /A:h ~$*.do*

REM Select the C: drive
C:
REM Select Office startup folder
CD \Program Files\Microsoft Office\Office11\Startup
REM Delete orphaned hidden temporary files
DEL /A:h ~$*.do*

REM If there are any third party add-ins that use a different folder
REM add those folders e.g.
REM Select SnagIt add-in folder
CD \Program Files\TechSmith\SnagIt 8
DEL /A:h ~$*.do*

REM Select the user temp folder
CD \Documents and Settings\Graham Mayor\Local Settings\Temp
REM Delete all temp files in the folder (its sub folders will not contain Word temp files).
DEL /Q *.*

Save in the Windows folder as WordFix.bat Create a shortcut to this file on the desktop and when the wheel comes off and Word crashes, click to delete the all the orphaned temp files.