Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory issue while generating word document

Status
Not open for further replies.
Apr 8, 2021
5
IN
hi

I am using vbscript to generate report in word document from the data from oracle data base( about 10K pages).

but I get following error after 1240 page

Error: 4605 - This method or property is not available because there is a memory or disk problem.

Thus I captured the error and saved the current document and quit the word application
...
set newDoc= oWord.activedocument
oWord.DisplayAlerts = False
newDoc.Saveas myfiledoc & "__"& i &".docx"
oWord.Quit
wscript.echo "word closed "
Set oWord = Nothing

and started another word application for part2 of document report .

Set oWord = CreateObject("Word.Application")
WScript.Echo "word application object created"
oWord.ScreenUpdating = False
oWord.Visible = false
Set oDoc = oWord.Documents.Add
...

But what I observed (in task manager window) that
1. original winword process is not getting stopped or killed though a new one started.
2. memory error still persist
3. new process getting created and destroyed but original one continues.
4. if I manually kill the winword process, every thing set right and this new winword runs till end without any problem.

My query is
1. how I can stop the initial winword process.
2. is there any way I can manage memory for winword without quitting the initial process
3. why and how the newly stated winword process continues without any problem.


Hope this is not too much to ask for.

Thanks in advance.




 
Whenever word crashes, the old process is in limbo - you need to kill it from the task manager.

One way around stopping the process from dying is to close the current document and start a new document every 500 or 1000 pages and continue the page numbering from the previous document. If you have page x of y, make page x of <document property pages>. Then when you get to the last page, go back and change the document property for all the documents.

You can always test this by setting the limit to 5 pages and generating a 17 page document before you go for the big one.
 
Try oWord.Visible=True for testing.
Try to close newDoc before closing Word, set newDoc to Nothing too.
oWord.DisplayAlerts in Word library can have any of wdAlertLevel values: wdAlertsAll=-1, wdAlertsMessageBox=-2, wdAlertsNone=0. In the last case default dialog action is executed.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top