Memory does not decrease



The memory used by my trial code - subroutine doDBa (please see below -
OL2003 VBA; this reading data lives on my PC) does not decrease as expected
after it runs an incremental using by my sub rep (Task Manager: if e = 1 Mem
Usage is 327684, if e = 2 Mem Usage is 430760 etc.) If e = 100 I get the
error message: Out of Memory.
Please, how do I have to change my code (preferred OL2003 VBA) so that will
finish correctly without error message Out of memory.

Public Sub rep()
e = 2
For j = 1 To e
doDBa
Next
End Sub

Public Sub doDBa()
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olInbox As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim olItem As Outlook.MailItem
Set olApp = Application
Set olNS = olApp.GetNamespace("MAPI")
Set colFolders = olNS.Folders
Set olMB = colFolders.Item("Osobní složky")
Set colFoldersMB = olMB.Folders
Set olFolderMB = colFoldersMB.Item("Buffer")
Set colItems = olFolderMB.Items
Set olItem = colItems.GetFirst
i = 0
Do While Not olItem Is Nothing
i = i + 1
If i = 100 Then
Exit Do
End If
Debug.Print i & " " & olItem.SenderName & " " & olItem.ReceivedTime
olItem.Delete
Set olItem = colItems.GetNext
Loop
Set olApp = Nothing
Set olNS = Nothing
Set colFolders = Nothing
Set colFoldersMB = Nothing
Set olFolderMB = Nothing
Set colItems = Nothing
Set olItem = Nothing
MsgBox i
End Sub
.



Relevant Pages

  • Re: Memory does not decrease
    ... Increase the size of PC virtual memory paging file atc. ... Dim olApp As Outlook.Application ... Set olItem = colItems.GetFirst ... Set colFolders = Nothing ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Memory does not decrease
    ... Increase the size of PC virtual memory paging file atc. ... Dim olApp As Outlook.Application ... Set olItem = colItems.GetFirst ... Set colFolders = Nothing ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Memory does not decrease
    ... OL2003 VBA; this reading data lives on my PC) does not decrease as ... Dim olApp As Outlook.Application ... Set olItem = colItems.GetFirst ... Set colFolders = Nothing ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Memory does not decrease
    ... I need to programmatically export items (Outlook Custom Forms, ... I need OL2003 VBA code because I must avoid security warnings when I use ... Dim olApp As Outlook.Application ... Set olItem = colItems.GetFirst ...
    (microsoft.public.office.developer.outlook.vba)