WHY? Memory issues

B

Ben Adams

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.
 
M

Michael Bauer

Hi Ben,

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

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