Word Automation: Formatting lost after certain number of pages...

M

Mark H. Shin

I am using Word Automation from within Access 2003 to create a Word document
based on a Word template I have created. The entire document is about 600+
pages.

I am using a heading named MAKE for level 1, MODEL for level 2, and Normal
(body text) for the records (line by line) so that I can insert an index
based on MAKE/MODEL later on in the document.

This seems to work fine for small Word documents, but for large documents,
after about the 218th page, WINWORD.EXE chokes and the rest of the document
is formatted in either of the other (than Normal) styles...

Any suggestions why Word looses formatting would be appreciated. I am using
code sample (outline form) below:

W.Documents.Add (CurrentFolder() & "CATALOG.DOT")
....
' write make
W.Selection.Style = W.ActiveDocument.Styles("MAKE")
W.Selection.TypeText RS_MAKE.Fields("MAKE")
W.Selection.TypeParagraph
....
' write model
W.Selection.Style = W.ActiveDocument.Styles("MODEL")
W.Selection.TypeText RS_MODEL.Fields("MODEL")
W.Selection.TypeParagraph
....
' write line entries
W.Selection.Style = W.ActiveDocument.Styles("NORMAL")
W.Selection.TypeText "<data records...>"
W.Selection.TypeParagraph

' give WINWORD.EXE time to catch up
DoEvents


Obviously, there much code lines left out intentionally....
 

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