
09-03-2003, 04:29 PM
|
|
Newcomer
|
|
Join Date: Sep 2003
Posts: 1
|
|
Out of Memory Problem driving me crazy
|
Ok here is the problem:
Below is the code that is giving me trouble. I have a global array delared to hold the information. The array is of type
Type PrintItems
BeginBates As String
EndBates As String
EmailNumber As Long
HasDuplicate As Boolean
DuplicateOf As String
foldername As String
ItemType As String
emailItem As outlook.MailItem
AttachemntFilename As String
to As String
from As String
cc As String
bcc As String
sentdate As String
subject As String
End Type
The code that is causing the Out of Memory errors is
----------------------------------------------------------
TotalEmails = TotalEmails + 1
PrintItemArray(x).EmailNumber = TotalEmails
PrintItemArray(x).DuplicateOf = PrintItemArray(DuplicateEmailNumber).EmailNumber
PrintItemArray(x).foldername = thefolder
PrintItemArray(x).ItemType = "Email"
Set PrintItemArray(x).emailItem = objitem
PrintItemArray(x).AttachemntFilename = ""
PrintItemArray(x).to = objitem.to
PrintItemArray(x).from = objitem.SenderName
PrintItemArray(x).cc = objitem.cc
PrintItemArray(x).bcc = objitem.bcc
PrintItemArray(x).sentdate = objitem.SentOn
PrintItemArray(x).subject = objitem.subject
-----------------------------------------------------------
I know this is where the problem is because if I comment out the
Set PrintItemArray(x).emailItem = objitem
line everything runs fine.
Now according to the SET statement description if i use SET without NEW then I should not be allocating memory but simply pointing to the object. The Procedure declaration is:
Sub AddEmailToDatabase(thefolder As String, objitem As outlook.MailItem)
Does anyone have any Ideas????
Frank J Nastro
|
|