how to control a winword instance in the ram

G

gil eiliya

hi.

i build a program in vb6 under win98se and i use word to print
documents, i open the word.application using the createObject
function, i don't close the word.application object each time i close
a word.document object to save running time, because that in my
program i need to print shipping bills that the user selects to print,
each bill can be few pages long and i open a word.document object each
page, fill it with the information of the order, print the page, close
the word.document object and opens the next page and so on, so for
saving time on opening a word.application each page i keep the object
open all the way, but i have a problem if after i finished printing i
still see the "winword" in the background(when i press alt+ctrl+del)
and that is fine for now, if now the user opens a word document and
closes it, it closes the winword instance in the ram that my program
opened, and if i now try to use the word.application object again for
printing it is closed and throws me an error.

how can i solve this problem that my instance of winword won't be
close ?, this problem doesn't happen with excel, i use excel the same
way as word, one difference is that when i use the excel, the excel is
visible and the user decides whether to print or not, and even if few
excel's is opened my excel do not overrun any other excel opened, i
use the findWindow API to find out if there is already an excel window
open, if so i don't quit the excel.application object when the program
ends, if there is an open excel then there is no problem, even if all
the excel applications is closed and i exit my program and my excel
object is still open and the findWindow API function returns that a
window is open and i don't quit the excel.application object because
of that, when the program quits the excel instance in the ram
vanished.

and after all this bla-bla my winword instance doesn't work the same
as the excel instance, i need a way how to control the word instance
so that after few times the user uses the program and print, the ram
will be filled with winword instances and might crash the computer
because lack of memory (the client's computers are slow, pentium or
celeron, and max of 128 Mb of Ram that is not little but they don't
close the computers all the week, but even then i don't want the
winword to clutter the memory with garbage.

thanks in advance for any help.
gil eiliya.
 

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