Re: Limitation with ActiveExplorer Selection?
From: Ken Slovak - [MVP - Outlook] (kenslovak_at_mvps.org)
Date: 07/21/04
- Next message: NaveenA: "Support for MAPI unicode"
- Previous message: diya gp: "Read Mails from Outlook n store in SQLServer"
- In reply to: John Riddle: "Re: Limitation with ActiveExplorer Selection?"
- Next in thread: Rafael: "Re: Limitation with ActiveExplorer Selection?"
- Reply: Rafael: "Re: Limitation with ActiveExplorer Selection?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 21 Jul 2004 08:44:06 -0400
There are a lot of factors involved, such as system resources and overall
RAM and virtual memory size. I've seen loops that worked correctly on my dev
machines cause out of memory errors on client's machines because of that.
There's a long-standing bug in how Outlook handles iterating collections of
items in loops. It creates internal variables that aren't released until
after the procedure exits and it gets worse the more dot operators you use,
since Outlook creates internal variables for each suboperator in the dots.
That's why using CDO 1.21 code works for loops like that, it doesn't create
those internal variables and can handle looping over much larger collections
than Outlook code can.
As far as specific limits on Selection, there aren't any hard and fast
rules. It just seems to break at some point.
-- 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 "John Riddle" <JohnRiddle@discussions.microsoft.com> wrote in message news:57012B59-C5DD-4FC7-9B30-ED028B05E58E@microsoft.com... > In my version of Outlook (2003), when I select a large number of items for processing, I generally run into memory problems after a couple hundred or so. However, I can very easily select several thousand and get a count (Selection.Count). I can't understand at all why he would be having a problem with that. > > Also, even if I only select a few dozen at a time and loop through them with a For...Next loop such as: > > Dim candFolder As MAPIFolder > Set candFolder = Application.ActiveExplorer.CurrentFolder > If candFolder.DefaultItemType = olContactItem Then > strJobTitle = "Manager" > strDepartment = "IT" > For Each cand In Application.ActiveExplorer.Selection > cand.JobTitle = strJobTitle > cand.Department = strDepartment > cand.Save > Set cand = Nothing > Next > strJobTitle = "" > strDepartment = "" > End If > Set candFolder = Nothing > > This code produces "Out of memory." errors if more than a couple hundred items are selected AND oddly enough, if I select only a couple dozen and process them, then select a couple dozen different items and process them and so on in stages like this, I still get memory errors after a few hundred. I'm convinced that processing items using the Selection collection has memory problems. > > Can you re-create this scenario Ken? > > John
- Next message: NaveenA: "Support for MAPI unicode"
- Previous message: diya gp: "Read Mails from Outlook n store in SQLServer"
- In reply to: John Riddle: "Re: Limitation with ActiveExplorer Selection?"
- Next in thread: Rafael: "Re: Limitation with ActiveExplorer Selection?"
- Reply: Rafael: "Re: Limitation with ActiveExplorer Selection?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|