Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Long Documents / March 2004

Tip: Looking for answers? Try searching our database.

Outof Memory Error When Programatically Resetting Numbering

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Hewett - 28 Feb 2004 14:29 GMT
Hi All

Word 2000/Windows 2000.

I have a Wizard that merges documents together, nothing particularly
fanciful. The documents being merged are almost completely built around
outline numbering. The outline numbering is a simple 4 level affair that
works well.

The outline numbering is built using the standard technique:
1.    Create a named ListTemplate
2.    Define the styles
3.    Define the ListLevels
4.    Set the ListLevels linked style

There are quite a few of these documents (100+) so for absolute consistency
all the above is done in code. All documents use the same template (which
is not the Wizard of course).

The template and all documents have had their list numbering setup using
this code.

As each document is merged I restart list numbering for the level 1 outline
style. This is to prevent follow on numbering from the previous document.
List numbering is reset using the standard method of:

   With .ListFormat
       .ApplyListTemplate .ListTemplate, False
   End With

And this is where the problem starts, I'm getting an "Out of memory" error
when executing the above statement! This is some 60+ documents into the
merge. At the time it fails the document's some 66 Sections, 650+ pages
long and the ListTemplate count is 1,790 and the ListParagraph count is
7,693.

I've tried most of the obvious stuff: Flush the documents undo buffer, save
document, etc.  Within the VBA IDE I've skipped over this statement and
forced execution to continue - which it does until the next time it hits
the same statement. So the problem is not memory in general (because it can
do other memory hungry things) but memory as it applies to ListTemplates.

I know about the hidden paragraph trick as an alternate way to reset
numbering and I know about ListNum fields, but I don't want to have to
revise all of these documents if at all possible.

Obviously reducing the number of ListTemplates in each document is a
prerequisite, but is there any reliable way to do this?

Your thoughts, ideas and suggestions (other than what I can do with it!)
are warmly welcomed!

Almost anything constructive considered!

Thanks in advance + Cheers - Peter
Word Heretic - 28 Feb 2004 22:48 GMT
G'day Peter Hewett <Nospam@xtra.co.nz>,

Try an ActiveDocument.UndoClear just before the edit in your main
loop.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)

Peter Hewett reckoned:

>Hi All
>
[quoted text clipped - 51 lines]
>
>Thanks in advance + Cheers - Peter
Bob S - 09 Mar 2004 20:43 GMT
Is the problem simply due to the large number of (presumably unused)
list templates? Wouldn't round-tripping through HTML after each merge
keep them from building up?

Bob S

>Hi All
>
[quoted text clipped - 51 lines]
>
>Thanks in advance + Cheers - Peter
Peter Hewett - 09 Mar 2004 22:16 GMT
Hi Bob

I fixed the problem a week ago at the expense of 1000+ lines of code! In
the end I recreated the base template from scratch. When I'd finished this
the template contained just 25 ListTemplates! I then used the code to
iterate through the documents and create new documents from the template
and then copied the text over from the old document (excluding the final
paragraph mark). I then updated and reapplied the appropriate styles (not
always the original). I used Word XP for this little exercise.

Using HTML I would have lost too much formatting. I tried RTF, but that
seemed to perpetuate the whole original mess!

But thank you for your suggestion.

Cheers - Peter

> Is the problem simply due to the large number of (presumably unused)
> list templates? Wouldn't round-tripping through HTML after each merge
[quoted text clipped - 58 lines]
>>
>>Thanks in advance + Cheers - Peter
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.