...administrator has limited the number of items you can open simultaneously

Status
Not open for further replies.

Blair

Member
Outlook version
Outlook 2016 64 bit
Email Account
Exchange Server
I am attempting to cycle through the selected items in a displayed (Exchange) folder in the Outlook Explorer, and extract pieces of information from the e-mail messages there.

Based on code I found on this site, I have reproduced the problem as simply as possible. The code I'm using is listed below.

The problem I'm encountering is on the debug.print line, after VBA cycles through about 247 messages, it errors with the message,

Code:
Microsoft Visual Basic
Run-time error '-2147220731 (80040305)':

Your server administrator has limited the number of items you can open simultaneously. Try closing messages you have opened or removing attachments and images from unsent messages

However, if that same debug.print line uses the data element ".subject" instead of ".SenderName", the code works fine, and can cycle through a thousand or more messages.

I've read there may be a need to do some clean-up of objects, but I cannot quite understand exactly where or how I would do this. I'm setting "obj=nothing" after getting the information I need for each pass through the For/Next loop, but this does not resolve the problem. I've found articles describing the possibility of doing a garbage collection, or using a Marshal command, but these result in a syntax error, perhaps because I don't have the right references set in my VBA project?

I would be very grateful for any assistance or guidance in this matter.

Code:
Option Explicit

Public Sub ReproduceErr()
Dim currentExplorer As Explorer
Dim obj As Object
Dim Selection As Selection
Dim Session As Outlook.NameSpace
Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

    For Each obj In Selection
        With obj
            Debug.Print .SenderName  'This caused the too many items failure when more than 250 items are selected
        End With
        Set obj = Nothing
    Next
    MsgBox "Complete"
'Clean up objects
Set Session = Nothing
Set currentExplorer = Nothing
Set obj = Nothing
Set Selection = Nothing

End Sub
 
Michael,

Thanks. That is helpful, although that code operates on all items within a specified folder. I'll have to play with it to get it to function for selected messages.

Time for a refresher on Outlook's object model.

-Blair
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Your server administrator has limited the number of items you can Outlook VBA and Custom Forms 5
S "Symstem Administrator" rejects msgs. Using Outlook 1
F System administrator undeliverable in outlook 2007 Using Outlook 1
C can't backup OL 2007 (error message 0x80070021) + only done by administrator Using Outlook 1
S System Administrator email undeliverable to following recipients Outlook 2007 Using Outlook 4
S How do I enable administrator access in Business Contact Manager? BCM (Business Contact Manager) 1
M The server is not available. Contact your administrator if this co BCM (Business Contact Manager) 1
S Administrator BCM (Business Contact Manager) 1
E "The operation cannot be performed because the message has been changed" Using Outlook 3
D Outlook 365 Outlook Message "Cannot be sent because the message has changed" Using Outlook 0
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
CWM330 This rule has a condition that the server cannot process? Using Outlook 1
Aussie Outlook 365 Rule runs manually but returns the error code "an unexpected error has occurred" when incoming mail arrives Using Outlook 1
e_a_g_l_e_p_i Has nobody used Office 2021 enough to help me or have you given up on me.......lol Using Outlook 1
O Comma Separated Values.ADR and A file error has occurred in the translator Using Outlook 6
D We're sorry but outlook has run into an error Using Outlook 6
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
N Outlook Has Become Sluggish Using Outlook 12
C Your mailbox has been temporarily moved ... Using Outlook 2
W Receiving mail for account that has been deleted Using Outlook 2
H Outlook 2003 find by "has attachment" Using Outlook 1
W Looks like the folder below has been deleted: "iCloud\Calendar" Using Outlook 1
oliv- determine to which address an email has been sent Outlook VBA and Custom Forms 3
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Outlook 2016 has "Outlook 2015" files Using Outlook 2
M Outlook 2016 bottom reading pane has disappeared Using Outlook 2
G Download pdf attachments only if email subject has one of words Outlook VBA and Custom Forms 8
B Looking to filter (or just find/search) for only messages that the sender has sent more than 1 messa Using Outlook 2
M AVG has banjaxed Outlook. Using Outlook 1
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
A Outlook incompleted tasks has strike through Using Outlook 3
B Search function in Office 365 has stopped working Using Outlook 3
I Check if sent email has been replied Outlook VBA and Custom Forms 1
S Outlook.com Sync working, Sync to Android has issues Using Outlook.com accounts in Outlook 1
Witzker Has Outlook 2010 to be opened for Indexing Win7 Using Outlook 1
Diane Poremsky RMS Error: System clock has been tampered with Using Outlook 0
Aussie I Change the Subject Line ... but after it is moved the subject has reverted Using Outlook 1
M Exchange 2013 On premise set MessageRateLimit for User has no effect. Exchange Server Administration 0
J "This item has been changed still want to delete it" message Using Outlook 3
E Reading Pane has disappeared Using Outlook 1
tswatek Microsoft Outlook has stopped working Using Outlook 13
H Is It Possible to See Who Has Viewed My Calendar in Exchange? Using Outlook 2
padubajacket Microsoft Outlook has stopped working Using Outlook 2
C Need rule to alert when an email has not been replied to within 24 hours Using Outlook 1
Diane Poremsky This operation has been cancelled due to restrictions Using Outlook 0
R Exchange - Locating a user that has log files but is not found using powershell Exchange Server Administration 1
L An () has been inserted after the address in an address box; how do I remove them. Using Outlook 1
I Icloud has hijacked my calendar Using Outlook 2
JorgeDario how to check a MailItem has a digital signature (SMIME) with vba? Outlook VBA and Custom Forms 1
Rory Campion Not getting a warning when a shared calendar item has been updated by someone else Using Outlook 2

Similar threads

Back
Top