UndoClear doesn't?

K

Ken

I've noticed that a particular tmp file increases in size every time I edit
any of my styles in a Word document. It happens whether I make the changes
manually or using a macro, and the the UndoClear method doesn't seem to have
any effect. It's a problem because if I run a macro that does a LOT of
editing, the tmp file eventually gets so big that the macro no longer runs (I
get a messaging saying the command can't be executed because there's a memory
or disk problem).

The tmp file in question is in c:\Documents and Settings\[me]\Local
Settings\Temp and is always called ~WRS####.tmp (#### is a number that
changes every time I restart Word).

Track changes is off.

Any ideas on how to prevent Word from keeping track of all these changes so
the tmp file doesn't expand until it crashes? The only way I've found to
eliminate the problem is to close Word and restart it, which deletes the tmp
file and starts the process all over again.

I posted about this earlier today but after doing some investigating I've
narrowed down the problem so I'm posting this separate thread that's more
specific. Thanks for being understanding!
 
H

Helmut Weber

Hi Ken,

about the UndoClear-method,
I think, as Word was originally designed IMHO as an
ordinary office-application for small documents,
UndoClear may not clear anything but only set a flag
for, lets say, "disregard" something,
trading speed for slow reliability.

There was once an unknown barrier of complexity,
which Word just couldn't handle anymore.
Maybe it is still there.

I'd try to split up all that editing in single steps.
SaveAs doc-000.doc.
Do Step 1
SaveAs doc-001.doc.
Do step 2
SaveAS doc-002.doc.

Sure, slow and not that easy.

To the best of my knowledge.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

Jay Freedman

What I can add to Helmut's suggestion isn't from real knowledge but
guesswork based on little clues.

According to http://support.microsoft.com/?kbid=211632, a temp file that
starts with ~WRS is a "scratch file". Its description is:

~~~~
When Word runs out of internal random access memory (RAM), it always creates
a single temporary scratch file in the Temp directory to hold information.
This scratch file holds information that is swapped out from the Word
internal file cache, which is allocated from global system memory. The
scratch file varies in size from 64 kilobytes (KB) to 3.5 megabytes (MB).
~~~~

This is where the guesswork comes in: Although it's true that the Undo
buffer is internal to Word, I don't know whether it's part of the internal
file cache that overflows into the scratch file. I also don't know whether
Word has code to shrink the scratch file when the overflow is reduced, or
whether it only grows until the document is closed and the temp file is
discarded.

If Helmut's suggestion of periodically saving the document doesn't help,
then try periodically closing and reopening the document. I'd also be
looking hard at the macro to see whether the amount of editing it does can
be reduced. For example, if you're deleting a group of adjacent paragraphs,
try not to delete them one at a time.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
K

Ken

Thanks Helmut and Jay. I'm going to have to rewrite the macro a bit but a
lot of the editing is unavoidable, so I'll also have to figure out a way to
calculate/guess when that temp file is getting out of hand (400-500mb seems
to be the point where Word gives up) and warn the user to restart Word.
Closing and opening the document doesn't affect that temp file, only closing
Word properly. I've noticed that those WRS files don't get deleted if Word
crashes, but they don't seem to have any effect on subsequent Word sessions
(might be wrong on that).

Jay Freedman said:
What I can add to Helmut's suggestion isn't from real knowledge but
guesswork based on little clues.

According to http://support.microsoft.com/?kbid=211632, a temp file that
starts with ~WRS is a "scratch file". Its description is:

~~~~
When Word runs out of internal random access memory (RAM), it always creates
a single temporary scratch file in the Temp directory to hold information.
This scratch file holds information that is swapped out from the Word
internal file cache, which is allocated from global system memory. The
scratch file varies in size from 64 kilobytes (KB) to 3.5 megabytes (MB).
~~~~

This is where the guesswork comes in: Although it's true that the Undo
buffer is internal to Word, I don't know whether it's part of the internal
file cache that overflows into the scratch file. I also don't know whether
Word has code to shrink the scratch file when the overflow is reduced, or
whether it only grows until the document is closed and the temp file is
discarded.

If Helmut's suggestion of periodically saving the document doesn't help,
then try periodically closing and reopening the document. I'd also be
looking hard at the macro to see whether the amount of editing it does can
be reduced. For example, if you're deleting a group of adjacent paragraphs,
try not to delete them one at a time.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
I've noticed that a particular tmp file increases in size every time
I edit any of my styles in a Word document. It happens whether I
make the changes manually or using a macro, and the the UndoClear
method doesn't seem to have any effect. It's a problem because if I
run a macro that does a LOT of editing, the tmp file eventually gets
so big that the macro no longer runs (I get a messaging saying the
command can't be executed because there's a memory or disk problem).

The tmp file in question is in c:\Documents and Settings\[me]\Local
Settings\Temp and is always called ~WRS####.tmp (#### is a number that
changes every time I restart Word).

Track changes is off.

Any ideas on how to prevent Word from keeping track of all these
changes so the tmp file doesn't expand until it crashes? The only
way I've found to eliminate the problem is to close Word and restart
it, which deletes the tmp file and starts the process all over again.

I posted about this earlier today but after doing some investigating
I've narrowed down the problem so I'm posting this separate thread
that's more specific. Thanks for being understanding!
 
J

Jay Freedman

Cleaning up after crashes may help to prevent future crashes...
http://www.gmayor.com/what_to_do_when_word_crashes.htm

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Thanks Helmut and Jay. I'm going to have to rewrite the macro a bit
but a lot of the editing is unavoidable, so I'll also have to figure
out a way to calculate/guess when that temp file is getting out of
hand (400-500mb seems to be the point where Word gives up) and warn
the user to restart Word. Closing and opening the document doesn't
affect that temp file, only closing Word properly. I've noticed that
those WRS files don't get deleted if Word crashes, but they don't
seem to have any effect on subsequent Word sessions (might be wrong
What I can add to Helmut's suggestion isn't from real knowledge but
guesswork based on little clues.

According to http://support.microsoft.com/?kbid=211632, a temp file
that starts with ~WRS is a "scratch file". Its description is:

~~~~
When Word runs out of internal random access memory (RAM), it always
creates a single temporary scratch file in the Temp directory to
hold information. This scratch file holds information that is
swapped out from the Word internal file cache, which is allocated
from global system memory. The scratch file varies in size from 64
kilobytes (KB) to 3.5 megabytes (MB). ~~~~

This is where the guesswork comes in: Although it's true that the
Undo buffer is internal to Word, I don't know whether it's part of
the internal file cache that overflows into the scratch file. I also
don't know whether Word has code to shrink the scratch file when the
overflow is reduced, or whether it only grows until the document is
closed and the temp file is discarded.

If Helmut's suggestion of periodically saving the document doesn't
help, then try periodically closing and reopening the document. I'd
also be looking hard at the macro to see whether the amount of
editing it does can be reduced. For example, if you're deleting a
group of adjacent paragraphs, try not to delete them one at a time.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
I've noticed that a particular tmp file increases in size every time
I edit any of my styles in a Word document. It happens whether I
make the changes manually or using a macro, and the the UndoClear
method doesn't seem to have any effect. It's a problem because if I
run a macro that does a LOT of editing, the tmp file eventually gets
so big that the macro no longer runs (I get a messaging saying the
command can't be executed because there's a memory or disk problem).

The tmp file in question is in c:\Documents and Settings\[me]\Local
Settings\Temp and is always called ~WRS####.tmp (#### is a number
that changes every time I restart Word).

Track changes is off.

Any ideas on how to prevent Word from keeping track of all these
changes so the tmp file doesn't expand until it crashes? The only
way I've found to eliminate the problem is to close Word and restart
it, which deletes the tmp file and starts the process all over
again.

I posted about this earlier today but after doing some investigating
I've narrowed down the problem so I'm posting this separate thread
that's more specific. Thanks for being understanding!
 
K

Ken

Turns out that temp file bloat is a bug that MS identified in Word 97 (!!)
and hasn't fixed. Here's a link to the KB article:

WD97: Creating Large Numbers of Styles Creates Huge Scratch File
http://support.microsoft.com/kb/168805/en-us

Their solution is to restart Word. That's the only way I've found to get
past it. Clearing out other temp files has no effect.

I'm not creating large numbers of styles but I'm working with styles a lot.
Every time I access a style property the temp file grows, and if I access a
lot of properties the file grows a lot which eventually stops Word from
working properly.

Argh.

They've confirmed that it's a problem and are researching it. Since 1997.
It would be nice if they'd fix things like this as a bit more of a priority
than rearranging menus and designing pretty ribbon bars.

Now I've got to figure out a way to track that scratch file and notify the
user before it gets too big.

Jay Freedman said:
Cleaning up after crashes may help to prevent future crashes...
http://www.gmayor.com/what_to_do_when_word_crashes.htm

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Thanks Helmut and Jay. I'm going to have to rewrite the macro a bit
but a lot of the editing is unavoidable, so I'll also have to figure
out a way to calculate/guess when that temp file is getting out of
hand (400-500mb seems to be the point where Word gives up) and warn
the user to restart Word. Closing and opening the document doesn't
affect that temp file, only closing Word properly. I've noticed that
those WRS files don't get deleted if Word crashes, but they don't
seem to have any effect on subsequent Word sessions (might be wrong
What I can add to Helmut's suggestion isn't from real knowledge but
guesswork based on little clues.

According to http://support.microsoft.com/?kbid=211632, a temp file
that starts with ~WRS is a "scratch file". Its description is:

~~~~
When Word runs out of internal random access memory (RAM), it always
creates a single temporary scratch file in the Temp directory to
hold information. This scratch file holds information that is
swapped out from the Word internal file cache, which is allocated
from global system memory. The scratch file varies in size from 64
kilobytes (KB) to 3.5 megabytes (MB). ~~~~

This is where the guesswork comes in: Although it's true that the
Undo buffer is internal to Word, I don't know whether it's part of
the internal file cache that overflows into the scratch file. I also
don't know whether Word has code to shrink the scratch file when the
overflow is reduced, or whether it only grows until the document is
closed and the temp file is discarded.

If Helmut's suggestion of periodically saving the document doesn't
help, then try periodically closing and reopening the document. I'd
also be looking hard at the macro to see whether the amount of
editing it does can be reduced. For example, if you're deleting a
group of adjacent paragraphs, try not to delete them one at a time.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Ken wrote:
I've noticed that a particular tmp file increases in size every time
I edit any of my styles in a Word document. It happens whether I
make the changes manually or using a macro, and the the UndoClear
method doesn't seem to have any effect. It's a problem because if I
run a macro that does a LOT of editing, the tmp file eventually gets
so big that the macro no longer runs (I get a messaging saying the
command can't be executed because there's a memory or disk problem).

The tmp file in question is in c:\Documents and Settings\[me]\Local
Settings\Temp and is always called ~WRS####.tmp (#### is a number
that changes every time I restart Word).

Track changes is off.

Any ideas on how to prevent Word from keeping track of all these
changes so the tmp file doesn't expand until it crashes? The only
way I've found to eliminate the problem is to close Word and restart
it, which deletes the tmp file and starts the process all over
again.

I posted about this earlier today but after doing some investigating
I've narrowed down the problem so I'm posting this separate thread
that's more specific. Thanks for being understanding!
 

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