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.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
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.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
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
[quoted text clipped - 18 lines]
> I've narrowed down the problem so I'm posting this separate thread
> that's more specific. Thanks for being understanding!
Ken - 17 Aug 2007 02:19 GMT
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).
> What I can add to Helmut's suggestion isn't from real knowledge but
> guesswork based on little clues.
[quoted text clipped - 45 lines]
> > I've narrowed down the problem so I'm posting this separate thread
> > that's more specific. Thanks for being understanding!
Jay Freedman - 17 Aug 2007 14:32 GMT
Cleaning up after crashes may help to prevent future crashes...
http://www.gmayor.com/what_to_do_when_word_crashes.htm

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
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
[quoted text clipped - 63 lines]
>>> I've narrowed down the problem so I'm posting this separate thread
>>> that's more specific. Thanks for being understanding!
Ken - 18 Aug 2007 11:46 GMT
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.
> Cleaning up after crashes may help to prevent future crashes...
> http://www.gmayor.com/what_to_do_when_word_crashes.htm
[quoted text clipped - 66 lines]
> >>> I've narrowed down the problem so I'm posting this separate thread
> >>> that's more specific. Thanks for being understanding!