WHY? Memory issues

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Trying to export info from a form, Keeps stopping every 300 records

How can I clear the memory after it writes?


Sub exportitems()

Dim ol As Outlook.Application

Dim MyEntryID(50000) As String
Dim StoreID As String
Dim EntryID As String
Dim c As Outlook.ContactItem

Set ol = New Outlook.Application

Set olns = ol.GetNamespace("MAPI")
Set myfolder1 = olns.Folders("Public Folders") 'set move to folder up
Set myfolder2 = myfolder1.Folders("All Public Folders")
Set myfolder3 = myfolder2.Folders("Key Customer Contacts")
Set objFolder = myfolder3
' Get the StoreID, which is a property of the folder.

StoreID = objFolder.StoreID
' Set objAllContacts equal to the collection of all contacts.
Set AllContacts = objFolder.Items

Open "c:\keycontacts.txt" For Output As #1 ' Open file for output.

I = 0

For Each Item In AllContacts


Write #1, _
Item.account, Item.CompanyName
Next


Close #1 ' Close file.
 
Hi Ben,

please use CDO instead of the OOM. It´s much faster and not subject to
the known OOM´s memory leak problem.
 
Back
Top