I have an Access program whereby I am importing some information into access from Word documents. The code also looks for certain criteria in the Word documents, and breaks it up into smaller word documents based upon those criteria. A typical word file that I am trying to break down into smaller units could contain as many as 500 different pieces, but each of those pieces is less than a page long (usually).
The code is very intense and quite lengthy so I won't post it all here, but basically, the flow is as follows..
1. Create an object (Set WD = createObject("Word.Application")
2. Open the original word document
3. Find my content in the document
4. Set a range for that content
5. Copy the range
6. Create a new document (and yes, another instance of Word running)
7. Paste in the content
8. Close the new document
9. Return to my original document and find the next piece, and then repeat steps 3-9.
I know that the code that I have is not opening tons of word applications. At most, I only have 2 sessions running.
The program successfully breaks down the documents and it copies about the first 20 documents, and then I get an "out of memory" problem, and I obviously can't get it to go further.
I am not asking anyone to write the code, but rather I am asking for advice on where to start looking for memory leaks? Although I am a power user in both Access and Word, this is my first program that I have accessed Word through VBA (I have done tons of Access VBA programming, though!)
Can anyone suggest where to start my hunt? I am afraid that I simply don't know where to look.
Thanks for your help.
The code is very intense and quite lengthy so I won't post it all here, but basically, the flow is as follows..
1. Create an object (Set WD = createObject("Word.Application")
2. Open the original word document
3. Find my content in the document
4. Set a range for that content
5. Copy the range
6. Create a new document (and yes, another instance of Word running)
7. Paste in the content
8. Close the new document
9. Return to my original document and find the next piece, and then repeat steps 3-9.
I know that the code that I have is not opening tons of word applications. At most, I only have 2 sessions running.
The program successfully breaks down the documents and it copies about the first 20 documents, and then I get an "out of memory" problem, and I obviously can't get it to go further.
I am not asking anyone to write the code, but rather I am asking for advice on where to start looking for memory leaks? Although I am a power user in both Access and Word, this is my first program that I have accessed Word through VBA (I have done tons of Access VBA programming, though!)
Can anyone suggest where to start my hunt? I am afraid that I simply don't know where to look.
Thanks for your help.