Pagination is changed by Close/Open

C

Composer

Synopsis: When new doc created by VBA, it has 25 pages. After closing
and opening, it has 23 pages.

(Copied from microsoft.public.word.pagelayout, having had no reply
after 3 days.)


I'm using Word 2000 as an automation server under XP Pro.

MS-Access VBA code creates a new Word doc based on a template.

My client is extremely picky about the final look of the document, and
wants it formatted by the software at the push of a button -- because
every time a detail in the database is fine-tuned, they want a new Word

doc that doesn't need manual adjusting.

Problem:

VBA code does its final clean-up of the new Word doc based partly on
where page breaks are found. Eg. if a very long table cell has caused

lots of white space to be left on the preceding page, the cell will be
split. However, the pagination that VBA works with is not the same as

the final document's. Have observed an example that is 25 pages long
while VBA is running, which after saving, closing, and opening again
turns out to have only 23 pages. As a result the fine-tuning done by
VBA is now wrong.

Have tried various combinations of doc.Repaginate, doc.PrintPreview,
etc. The final pagination does not seem to happen until the document
has been closed and opened.

I suppose I could close and reopen the doc within the VBA code, but
this changes the logic flow. Is it avoidable?

Thanks.
 
A

Anne Troy

I saw this before. I am working on a similar project for a client. It's
nothing but heartache. The only thing I can think could be happening... Does
your document have a table of contents that, perhaps, upon close and reopen,
is updating to contain FEWER items? If possible, I'd like to see a document
created by this system before it's been opened. You can upload at
www.officearticles.com/forum or even email it if you must.
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com
 
C

Composer

Anne, thanks for your input. Sadly I can't blame the problem on a
table of contents, as there is none.

Something else I've noticed, which may be irrelevant: certain bugs
occur if I let the VBA code run uninterrupted, which don't occur if the
code pauses for user input. Makes me wonder whether the repagination
would be OK if the code waited long enough. On the other hand, I think
this hypothesis is incorrect, as I've stopped code execution and
manually finished the document, and find that there are always 25 pages
until I've closed and reopened it.

Guess I'll have to try the brute-force method of closing/opening within
VBA.
 

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