WORD Automation Frustrations

E

Enrique Rojas

I need some advice on what to do for this project.

There has been VBA code written in Access to generate Word documents.
It works wonderfully. I was given the task to copy this functionality
on the web with ASP.

I managed to do it except that inconsistent errors are crop up every 2
or 3 times when runned. The main crux of this application is that it
generates tables from the database.

It seems to me that Word halts when you ask it to generate large tables
in the document.

I have been pulling my hairs and have not left work in 24 hours just to
figure out this thing.

Is there another solution I can implement that will allow me to
generate word documents from a database downloadable for the users.

PS: The documents are pulled from a template pool based on an ID
specific to the department. Queries are made based on department ID.

I was thiking of making a dll that the asp page will pass on the
parameters and word document will be generated.

Any advice would be welcomed. It would be ideal if i can salvage the
code i have now and get that to work.

Sorry I am rambling i need to sleep.
 
M

Malcolm Smith

Word chokes if you ask it to do too much from another application.

I have a routine which I call every now and then from the calling
application which seems to sort out this problem. The title seems to be
self explanatory.

I use it for my daily report runs and without it it wouldn't work.

There's just two arguments being passed, a pointer to the Word application
and a pointer to the Document.

Hope that this helps.

- Malc



Private Sub PreventWordDeath(moWord As Word.Application, objDoc As
Word.Document)

On Error Resume Next


DoEvents

objDoc.UndoClear
objDoc.Repaginate

DoEvents

moWord.Options.Pagination = False
With moWord.Application
.ScreenUpdating = True
.ScreenRefresh
.ScreenUpdating = False
End With

DoEvents

End Sub
 

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