Re: Memory does not decrease



Michael,
I need to programmatically export items (Outlook Custom Forms, user defined
fields; 14500 items per day) to Access 2003.
I need OL2003 VBA code because I must avoid security warnings when I use
properties that are blocked by the Outlook 2003 object model guard. I mustn't
use Redemption ... (very rescrictive Security Policy)
Increase the size of PC virtual memory paging file atc. no more.
A response to my question (please see Subject: Out of Memory problem) helped
me to increase the number of items I could iterate before running out of
memory.
This (belowe) code is in agreement (? - I don't know how else) with a
support "An alternative is to call your loop procedure repeatedly etc."
Sorry, can you help me please?
Josef


"Michael Bauer" wrote:

Am Mon, 13 Feb 2006 02:54:57 -0800 schrieb Josef:

Josef,

please, what is that good for?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


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

  • Question abt Outlook 2003 VBA application by Sue Mosher*10152008
    ... ' built-in ThisOutlookSession session module in Outlook VBA ... Dim strAddress As String ... Set objContact = colContacts.Find ...
    (microsoft.public.outlook.program_vba)
  • Re: Outlook 2003 Macro Causes VBA to be Disabled
    ... Outlook VBA and Outlook 2003 VBA code is very sensitive to things like that. ... Dim objApp As Application ...
    (microsoft.public.outlook.program_vba)
  • Re: Permissions on other users calendars / recurring appointments
    ... In VBA, yes I do. ... "Dmitry Streblechenko" wrote: ... OutlookSpy - Outlook, CDO ... Dim oFdr As Outlook.MAPIFolder ...
    (microsoft.public.outlook.program_vba)
  • Re: scripting and ADO
    ... adOpenDynamic and other ADO constants aren't. ... Sue Mosher, Outlook MVP ... > lot of this with VBA and had no problems - another story in VBS. ... > Dim cn ...
    (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)