Performance problem with copying from data

L

Long Nguyen

Hi,

I have a vbscript that copies data from request forms in a folder to a CSV
file. The folder has some 800 forms. Basically I use a FOR loop to go
through each item in the folder and check if the RequestType field in the
item is what I want and if so copy all 40+ fields from that item to the CSV
file.

PROBLEM:
The problem is that when the FOR loop has processed about 250 items, I keep
getting the message "system resource low or out of memory" every time it
tries to process the next item. I can not close Outlook even through Task
Manager (got the message "can not quit"). The only way to get out of this
form run is to reboot the PC (by pressing the power button;
ALTER-CNTL-DEL -Shutdown does not work).

MY ATTEMPT:
1) I have tried to close the item and set all variables used in the script
to Nothing after each cycle of the FOR loop, but it does not help.
2) I have tried to reduce the number of forms copied in one run by copying
only forms with a particular RequestType but it did not help (in this case I
still need to go through all items in the folder to check for the
RequestType field).
3) I have also tried to use Restrict method to get back only forms with one
particular RequestType but have not been able to get the code with restrict
worked yet (I have sent another post on Restrict question).

Could someone give me an idea on how to get around this performance problem.
Are 800 forms too many to process in one go?

Thanks in advance.
Long
 
L

Long Nguyen

Thanks Ken for teh information. Much appreciated.

Regards
Long

Ken Slovak - said:
There are memory leaks when using the Outlook object model in a loop
and those memory leaks are due to internal variables Outlook
instantiates in the loop. The internals aren't released until the
procedure you are in is exited.

Restricting the collection will help as will increasing the size of
your Windows virtual memory. If you need to get all fields from an
item then you can't use SetColumns to limit the fields retrieved by
Outlook. The other main workaround is to use CDO 1.21 code instead of
Outlook code, that is an order of magnitude faster and doesn't have
the same looping memory leaks.

CDO is an optional installation with Outlook 2000 and later and has a
different and more complex object model than Outlook does. For CDO
information see www.cdolive.com

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Long Nguyen said:
Hi,

I have a vbscript that copies data from request forms in a folder to a CSV
file. The folder has some 800 forms. Basically I use a FOR loop to go
through each item in the folder and check if the RequestType field in the
item is what I want and if so copy all 40+ fields from that item to the CSV
file.

PROBLEM:
The problem is that when the FOR loop has processed about 250 items, I keep
getting the message "system resource low or out of memory" every time it
tries to process the next item. I can not close Outlook even through Task
Manager (got the message "can not quit"). The only way to get out of this
form run is to reboot the PC (by pressing the power button;
ALTER-CNTL-DEL -Shutdown does not work).

MY ATTEMPT:
1) I have tried to close the item and set all variables used in the script
to Nothing after each cycle of the FOR loop, but it does not help.
2) I have tried to reduce the number of forms copied in one run by copying
only forms with a particular RequestType but it did not help (in this case I
still need to go through all items in the folder to check for the
RequestType field).
3) I have also tried to use Restrict method to get back only forms with one
particular RequestType but have not been able to get the code with restrict
worked yet (I have sent another post on Restrict question).

Could someone give me an idea on how to get around this performance problem.
Are 800 forms too many to process in one go?

Thanks in advance.
Long
 

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