Recommend method of cleaning up corrupted documents ?

M

mansky99

Hi,
I have split the macros I had originally stored in Normal.dot up into 6
different templates and have thereby reduced the size of Normal.dot from
600+kB to 64kB (Cleaning up a load of dead code and inefficient code in the
process).

My question now is should I run a VB script to go thru all the Word
documents on the system and open and then save them as web pages, or delete
the last section in each document, in an attempt to "clean-up" potential
corrupted documents now that I've changed dramatically the code in Normal.dot
-and therefore the pointers to the various macros I call ?

If I understand the advice on the Word MVP website, pointers to the macros
used (if any) in a given document are stored in the last section of each
document. If Normal.dot has been completely re-organized, should the
programmer then run a "clean-up" script on the Word documents on their system
in order to get the pointers to the code used updated in a reliable manner,
or will Word update the pointers in the last section automatically, and more
importnantly to me, reliably?

If I am completely off-base with regards the pointers in Word and how Word
stores, in a given document, the info about which templates and macros to
call in displaying that document, please let me know. I really want to
understand what Word does in linking to and executing the macros and
templates used in a given document. Any book references, or webiste links on
the subject would be greatly appreciated.

Thanks!

Ed
 
D

Daiya Mitchell

Hi Ed,

I'm not a macro expert, but I don't think macros in Word work this way:
changed dramatically the code in Normal.dot
-and therefore the pointers to the various macros I call ?

Usually macros just do stuff and then move on. I don't think they leave a
pointer in the document. (and I've reshuffled all my macros and not noticed
any problems with corruption, though I don't think I had macros on the scale
that you do).

I suppose if the macros were designed to run when you opened the document,
or if the macros used to be stored in the doc itself, corruption *might* be
a potential issue worth considering. But even then I don't think so.

What do you mean by macros used in displaying a document? Even macros that
change the view or window size are not going to leave a pointer in the doc
itself, I don't think, and I can't imagine why anyone would have a macro
that did something like select the document and change the margins every
time you open the doc.

As far as I know, when Word opens a document, it does look for the template,
but I'm pretty sure that all an attached template does is control the
styles. More info:
http://shaunakelly.com/word/templaterelations/index.html

Did the discussion on the MVP site (of the last paragraph mark) specifically
mention macros? Can you point me toward that link?
 
M

mansky99

Hi Daiya,
Thanks for the reply and the link. I hadn't seen that website.

I took one of the problem documents I have and tried to save the entire
document as a web page, as per Procedure #1 of the fist web link I give
below. Word itself then crashed. The document is only about 2 pages of sparse
text (it's only a test example of the problem I am experiencing in Word).

To be clear, the specific problem w/"some" of my documents is that while
typing text into one of them, the text starts to take a long time to appear
in the window. Sometimes it doesn't appear at all. To get "control" again of
the document (ie. see the text typed in the window in a reasonable amount of
time), sometimes takes closing and then re-opening the document in Word.
Obviously, this is a pain. Also, I've not figured out a pattern to which
particular document will exhibit this problem. Some of the documents affected
were ones created via my macros (originally stored in Normal.dot). Other
affected documents were not created via my macros, but rather just plain new
blank documents.
In all these cases however, all the macros I had were in Normal.dot (I
didn't know of the Word MVP website and the advice therein at the time).

Now, I've moved 90% of the macros out of Normal.dot, into their own
templates.

So, my question is really what's the best way to go about cleaning
up/repairing these "problem documents"?

This all occurs on a Mac OSX 10.2.8 w/Word 10.1.6 and "AllowFastSaves" is
OFF and the only app in active use is Word. The system load is minimal.

If this is still unclear, let me know and I can post some example code from
the macros and clarify points.

More comments inline below.

Thanks!

Ed



Daiya Mitchell said:
Hi Ed,

I'm not a macro expert, but I don't think macros in Word work this way:


Usually macros just do stuff and then move on. I don't think they leave a
pointer in the document. (and I've reshuffled all my macros and not noticed
any problems with corruption, though I don't think I had macros on the scale
that you do).

I suppose if the macros were designed to run when you opened the document,
or if the macros used to be stored in the doc itself, corruption *might* be
a potential issue worth considering. But even then I don't think so.

What do you mean by macros used in displaying a document? Even macros that
change the view or window size are not going to leave a pointer in the doc
itself, I don't think, and I can't imagine why anyone would have a macro
that did something like select the document and change the margins every
time you open the doc.
I had macros that displayed text (literal strings and Date values for
example) via use of range objects. These macros also included Documents.Add
statements so that a new document was created with the desired text already
displayed in the document.
As far as I know, when Word opens a document, it does look for the template,
but I'm pretty sure that all an attached template does is control the
styles. More info:
http://shaunakelly.com/word/templaterelations/index.html

Did the discussion on the MVP site (of the last paragraph mark) specifically
mention macros? Can you point me toward that link?

The link containing info on how to clean-up a corrupted document:
http://word.mvps.org/macwordnew/documentcorruptioncontent.htm

Specifically, Procedure #2.

The second link is:
http://word.mvps.org/FAQs/General/WhyMasterDocsCorrupt.htm

While John McGhie doesn't specifically mention pointers to macros being
stored in the default section break, I assumed that Word would indeed store a
pointer to a macro in the case where the macro was a module in Normal.dot and
had range objects that displayed text in the document via ActiveDocument. If
this assumption is incorrect, please let me know. I am just trying to figure
out what is going on with these documents (w/o doing something like a hexdump
of the file) so I can learn to re-write my macros so as not to repeat the
problems in future documents.
 
B

Beth Rosengard

Hi Ed,

Procedure #1 of the article you referred to specifically says that if you're
in Word X, rather than Word 2004, you should first use Procedure #2. You
say below that you're in Word X! So ... you need to try copying all but the
last paragraph mark of one of these documents and pasting into a new
document as described. That *should* do it.

--
***Please always reply to the newsgroup!***

Beth Rosengard
MacOffice MVP

Mac Word FAQ: <http://word.mvps.org/MacWordNew/index.htm>
(If using Safari, hit Refresh once or twice ­ or use another browser.)
Entourage Help Page: <http://www.entourage.mvps.org>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top