Re: automation error
From: Ken Slovak - [MVP - Outlook] (kenslovak_at_mvps.org)
Date: 06/22/04
- Next message: Ken Slovak - [MVP - Outlook]: "Re: automation error"
- Previous message: Sue Mosher [MVP-Outlook]: "Re: Code to make a folder an Outlook address book?"
- In reply to: Thomas Wetzel: "Re: automation error"
- Next in thread: Thomas Wetzel: "Re: automation error"
- Reply: Thomas Wetzel: "Re: automation error"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Jun 2004 09:29:22 -0400
Although there are leaks when using any iterative loop with Outlook objects
and collections. The problem is that Outlook creates internal variables for
each pass through the loop and doesn't release them until the procedure
ends, even if you explicitly release any explicit variables you are using.
The problem can be minimized but not eliminated by not using compound dot
operators. Instead of using oFolder.Items(2) for example setting an Items
collection object and using that would help a little.
FWIW I almost always use For Each loops, which are faster than counted
loops, unless the collection might be large (say over 1500 items). Then I
use CDO 1.21 or Redemption to process the collection using a loop or a
MAPITable and that's not only faster but has fewer memory leaks.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Thomas Wetzel" <wetzel@wisco.de> wrote in message news:cb7f9p$i01$07$1@news.t-online.com... > Hello Ret, > > > Set iItems = fFolder.Items > > For Each iItem In iItems > > 'here I do something with the items > > Next > > Do never, NEVER use For each loops in Outlook. > > Outlook has memory leaks! Always count the items and then set the item like: > > set myItem=myFolder.items(2) > > > -- > > Thomas Wetzel > Synchronize or backup your Outlook quick and easy. > www.synchpst.com > >
- Next message: Ken Slovak - [MVP - Outlook]: "Re: automation error"
- Previous message: Sue Mosher [MVP-Outlook]: "Re: Code to make a folder an Outlook address book?"
- In reply to: Thomas Wetzel: "Re: automation error"
- Next in thread: Thomas Wetzel: "Re: automation error"
- Reply: Thomas Wetzel: "Re: automation error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|