PDA

View Full Version : Solved: Corrupt Custom Template



jemcases
05-06-2012, 10:50 PM
Hello All, I have created a template named AAA.dot. While working on the code for this template I went to google and surfed to a wbsite looking for help on customizing buttons, when the site opened my hdd went nuts and word crashed. I can open word just fine, but when I try to open my AAA.dot file or a new document based on AAA.dot word crashes with the following message: Microsoft Word for Windows has encountered a problem and needs to close...

I can open all files including normal.dot, except for AAA.dot. My guess is that the "ThisDocument.cls" file associated with the AAA.dot template is corrupt. I was working with the Document_New() procedure. The AAA.dot file is still intact, I just can't open it. Is there a way to retrieve the .cls file. I was able to retrieve the .mod and .frm files associated with the template but I don't know how to extract the .cls file.

Any help would be appreciated.
Thanks.

MacroShadow
05-06-2012, 11:25 PM
Take a look at How can I recover a corrupt document or template – and why did it become corrupt? (http://word.mvps.org/faqs/apperrors/corruptdoc.htm) on the Word MVP site.

fumei
05-07-2012, 12:45 AM
Oh-oh, that does not sound good at all.

"My guess is that the "ThisDocument.cls" file associated with the AAA.dot template is corrupt."

Please explain this. Why do you think this. ThisDocument.cls?

fumei
05-07-2012, 12:55 AM
Were you using ArcCatalog?

The only way to get a ThisDocument.cls is to export one in the first place. Why do you have (or had) one?

Did you get a different ThisDocument from this web page, and try to copy it into your template file? Please tell us what you actually did, including what web site you went to that apparently screwed the pooch for you.

jemcases
05-07-2012, 01:32 AM
Thank you for the responses, I'll take them one at a time.

MacroShadow I already read that information and the links, using the style-->organizer I was previously able to extract my template's macros and modules, but I am still unable to extract the .cls form aka "ThisDocument".

fumei I believe "ThisDocument" is corrupt because the vba code in the Open() or New() procedures fire as the page opens, so any code writen there that is undesirable to the functionality of Word will cause Word to crash, I least that's the only thing that makes sense to me now.Also I do not know what ArcExplorer is but I don't have it. I don't remeber which website I was visiting, but I was searching for customizing menu buttons at the time. "ThisDocument" is part of every word document including templates. Just open a Word document (new or existing) click Tools--> Macro--> Visual Basic Editor and it will be there for every open document. Dbl click on it and a code window will open where you can access procedures associated with that document. There is no need to import or export it, unless you can't open the file to edit, which is why I am still looking for a way to view this file.

By the way I am working with Word 2000.
Thanks again for your replies.

jemcases
05-07-2012, 02:47 AM
I was able to use the free software OpenOffice (OpenOffice.org) to get the .cls data. Just open the Word template in OpenOffice goto Tools--> Macros--> Organize -->Openoffice.org Basic and search through the listed files.

Frosty
05-07-2012, 09:09 AM
There is a difference between corruption and bad code. I assume you tried holding the SHIFT key down while opening the document, and I also assume you tried starting word "cleanly" by using "winword /a" in the Start > Run command.

That's probably all that the freeware does, with a UI to make it easier for non-coders.

But you're wrong about "no need to import or export it" as this thread has proven.

If you care about the code, you should export as a way of backing the file up (since that exported module cannot become corrupt) and also keeping backups of the template you are working on.

fumei
05-07-2012, 02:19 PM
I am well aware of what and where ThisDocument is. However, I was asking because ThisDocument.cls AS A FILE does not exist unless you export it.

My guess is that the "ThisDocument.cls" file associated with the AAA.dot template is corrupt. That implies there is a ThisDocument.CLS file. No,it does not imply, it states "file".

Try it. Try searching for ThisDocument.cls. It is an INTERNAL class for each and every document. Not a "file"...unless you export it.

Which may have something to do with Frosty's suggestion. If the the code you have in ThisDocument is crucial, then you SHOULD export it, as a backup.