Microsoft Knowledge Base Article - 293797
SYMPTOMS
You use the Outlook object model to loop through items in a folder, but run into memory limitations, or the amount of time that it takes to process an item increases as the collection of items is processed.
CAUSE
The items are based on a custom form that uses Microsoft Visual Basic Scripting Edition (VBScript), and Outlook does not release memory related to VBScript until the entire collection of items is processed.
RESOLUTION
You can add a registry key to limit the number of times that Outlook loads the VBScript code.
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
Create the following DWORD registry key and set its value to a number greater than 0:
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\< outlook version >\Outlook\Scripting\Threshold
Outlook limits the number of simultaneous script objects to that number. You can set it to any small number, which allows most looping scenarios to run. However, Microsoft recommends you set it to a value in the range of 10 to 20 because after you implement this registry key, custom forms that are opened through the Outlook user interface are also affected. For example, if you set the value to 2, and then open three custom forms with VBScript in them, the VBScript code will not run in the third item you open.
See: Microsoft Knowledge Base Article - 293797