Painkiller
Programmer
Hi all,
I'm facing the following problem: I'm searching different word documents for a certain text. At first I made a loop in which
a word object was made, the document was opened, actions took place, the document was closed and the object was destroyed. In
code:
Set Word = New Word.Application
Word.Visible = False
Word.Documents.Open strWordFile
...
[actions]
...
Word.Documents.Close
Set Word = Nothing
However for some reason in win NT this took a lot of memory. Research showed that thare were a couple of 20 winword.exe
processes running in the background (I did open 20 word docs). So I figured I only had to create 1 word object, and then in a
loop, open a document, actions and then close the document. The loop takes place 20 times (for 20 documents) and then the
word object is destroyed.
In the loop this leaves just the following code (with the wordobject beind created at the start of the program and being
destroyed at the end of the program):
Word.Documents.Open strWordFile
...
[actions]
...
Word.Documents.Close
However this gives the following error:
91 Object variable or With block variable not set
does anyone why I get this error? And why when using the first method 20 winword.exe processes were created?
Thanx in advance
Sujesh
I'm facing the following problem: I'm searching different word documents for a certain text. At first I made a loop in which
a word object was made, the document was opened, actions took place, the document was closed and the object was destroyed. In
code:
Set Word = New Word.Application
Word.Visible = False
Word.Documents.Open strWordFile
...
[actions]
...
Word.Documents.Close
Set Word = Nothing
However for some reason in win NT this took a lot of memory. Research showed that thare were a couple of 20 winword.exe
processes running in the background (I did open 20 word docs). So I figured I only had to create 1 word object, and then in a
loop, open a document, actions and then close the document. The loop takes place 20 times (for 20 documents) and then the
word object is destroyed.
In the loop this leaves just the following code (with the wordobject beind created at the start of the program and being
destroyed at the end of the program):
Word.Documents.Open strWordFile
...
[actions]
...
Word.Documents.Close
However this gives the following error:
91 Object variable or With block variable not set
does anyone why I get this error? And why when using the first method 20 winword.exe processes were created?
Thanx in advance
Sujesh