Am Mon, 22 Aug 2005 15:00:59 +0200 schrieb NotAMail:
You could use CDO instead of the Outlook object modell, which hasnīt a
memory leak. Maybe you need to install CDO first because itīs an
optional component (available on your Office CD).
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
> Hello Michael,
>
> I have try your code, and the same error appeared.
>
> NotAMail
>
>
> "Michael Bauer" <(E-Mail Removed)> wrote in message
> news:3vdcbf6rph4p.fwzo5upyaq9o$.(E-Mail Removed)...
>> Am Thu, 18 Aug 2005 14:02:42 +0200 schrieb NotAMail:
>>
>> Hi,
>>
>> please try this:
>>
>> Dim obj as Object
>>
>> For Each obj in Folder
>> If TypeOf obj is Outlook.MailItem Then
>> Set objMailItem=obj
>> Set objTemp=objMailItem.Copy
>> Set objTemp=objTemp.Move Folder2
>> Set objTemp=Nothing
>> Set objMailItem=Nothing
>> Endif
>> Next
>>
>> --
>> Viele Gruesse / Best regards
>> Michael Bauer - MVP Outlook
>>
>>> Hi,
>>>
>>> I try to copy more than 250 mailitem from my inbox folder to other
>> folder,
>>> "Toto" for example.
>>> When my code attempt to copy the 244 mailitem, it raise an error.
>>> I saw that there is a limit of item opened, which is about 255 but
in
>>> reality about 244.
>>>
>>> The problem occurs only on Outlook 2003. Not on Outlook 200 and
>> XP(2002).
>>>
>>> Can somebody help me.
>>>
>>> NotAMail
>>>
>>> My code (extract from VB application):
>>>
>>> Dim olApp As Outlook.Application
>>> Dim objName As NameSpace
>>> Sub Main()
>>> Dim Folder As MAPIFolder, Folder2 As MAPIFolder
>>> Dim objMailItem As Outlook.MailItem
>>> Dim Item As Outlook.MailItem, objTemp As MailItem, objTemp2 As
>> MailItem
>>> Dim i As Long
>>>
>>> Set olApp = Outlook.Application
>>> Set objName = olApp.GetNamespace("MAPI")
>>> Set Folder = objName.GetDefaultFolder(olFolderInbox)
>>> Set Folder2 =
>>> objName.GetDefaultFolder(olFolderInbox).Parent.Folders("Toto")
>>>
>>> iCount = Folder.Items.Count
>>> For i = 1 To iCount
>>> Set objMailItem = Folder.Items(i)
>>>
>>> Set objTemp = objMailItem.Copy
>>> 'Set objTemp2 = objTemp.Move(Folder2)
>>>
>>> objTemp.Close olDiscard
>>> 'objMailItem.Close olDiscard
>>>
>>> 'Set objTemp2 = Nothing
>>> Set objTemp = Nothing
>>> Set objMailItem = Nothing
>>> Next i
>>>
>>> Set objName = Nothing
>>> Set olApp = Nothing
>>> End Sub
|