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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Documents

Status
Not open for further replies.

keenanbr

Programmer
Oct 3, 2001
469
IE
We have an application which basically reads ascii files and populates Word documents through bookmarks in templates. When the volumes get high, the application crashes with an overflow error. The application is too large to post code but it crashes when the word document is opened. Clearing the temp directory alliviates the problem. Anyone got any ideas.

Regards,
 
One choice is to do a test of the data that's going to be entered before entering it. Perform a test against the data to see if it will cause an error in word before inserting. This will require you to find the limitations of what your version of word will handle. From the sounds of it, you've heavily modified your word document, so I'd start looking at field lengths first. If the error is being generated by a field length problem then you just run a .length comparison of the string you're about to insert and if it's > than your field length do something else like this:

If strInsertion.Length > 255 '255 is field length in word
FrogDance()
MsgBox ("Watch Michigan J Frog do a jig")
Else:
InsertToWord()
End If
 
thanks for your reply but I don't think that is the problem because if I clear the temp directory and re-submit the job it produces the document withot a problem.
 
Ahhh...so it's possible that you're app isn't closing down the word app like it's supposed to. You could use the filesystemobject to check if the tmp file exists and remove it before opening the document.
 
Having looked through the code, I think you may be right about the cause of the problem. However, it is going to take me some time to secure an adequet test environment (the joys of working for a large corporation). I will keep you posted.
 
Another thing to look for is memory leaks. Check that you are setting your WordApplication and all other Objects to Nothing when you finish with them.
 
Just to keep those who replied up to date. The test machine is using word 2003 and doesn't have this problem. The production machine has word 97. We intend upgrading to Word 2003 ASAP and I feel the problem will just go away. Still I'm curious.

Regards,
 
hi
dont know where to write this so if you do, please point me to it. i need a macro which copies tekst with its stiles and paragraphs and so on from one word document to another word document.

thnx
 
I'd probably post it in the VBA forum (Forum707).

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top