I\'m hitting problem with a reasonably straightforward vba macro for Microsoft Word which is designed to get around some issues we\'re seeing with list indentation when we creat
Your code looks OK and my sugestions will be just ideas to try doing the same another way...
Idea 1: insert a DoEvents somewhere in the innerloop, to facilitate garbage collection.
Idea 2: simplify your code by using FOR EACH constructs:
For Each curlist in Lists
For each curPar in curList.ListParagraphs
With curPar.Range.ListFormat.ListTemplate
.....
End With
Next curPar
Next curList
I've found a nasty, dirty solution that gets around the issue somewhat but is really a very poor fix. Basically, once we have gotten through one complete run of the macro, close and save the document and immediately reopen. This then allows the macro to be rerun immediately or at any stage because closing the document seems to eventually flush the memory properly. Obviously this can only be used if the user is happy to save as part of running the macro, but in my case it is
Besides UndoClear, you can also save the document at each loop.
It might heavily impact in your macro performance, though.
There's a similar issue here http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/de7a88b4-914f-4895-a88a-659b732e8d87/
Hope this helps.