N
NotAMail
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
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