Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010

    Unanswered: Type Error 424 on Collection

    This is a rephrasing of my last thread, focussing on a more specific issue. I am adding some objects to some collections as I go through a loop, so I can do things with them afterwards.

    The objects are being added to the collections ok, as far as I can see, but when I try to access the objects I get Error 424 and can't figure out why.

    Help much appreciated!
    Dim FailedObjects as New Collection
    Dim DoneObjects as New Collection
    Dim MailObject as Object
    Dim Inbox as Outlook.MAPIFolder
    Dim InboxItems as Outlook.Items
    (connect to Outlook...)
    (Set Inbox=...)
    Set InboxItems = Inbox.Items
    For Each MailObject In InboxItems
       ... do stuff ...
       If (...success...) Then
       End If
    For Each MailObject In FailedObjects
       msgbox "Hello"
    If I break at the start of the last "For", I can see that the Collections have been populated as I would expect. But I get Error 424 when I try to execute the "For".

    The first For loop - processing the Outlook inbox - works fine, so I'm fairly confident that I have my Outlook references and other stuff ok.

    Ideas, anyone?

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you may need to reset the internal pointer in the failedobjects collection, not certain if Access VBA needs that

    dumb question is their stuff in failedobjects.. there is no test that I can see to ensure there are prior to the for loop
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2010
    Thanks for the response.

    I'm fairly sure there is no pointer to reset - Microsoft examples don't show anything like that. In any case, in one experiment I did remake the loop as

    FOR i = 1 to FailedCollection.Count
    ... MailObject = FailedCollection.Item(i)

    in which case the loop worked as expected but the Object assignment failed as before.

    There definitely is stuff in the FailedObjects collection in this case - but it shouldn't matter if there is nothing, a For Each should simply skip over itself if the collection is empty (I think).

  4. #4
    Join Date
    Mar 2010
    Never mind - not solved this problem, but now not needed as I've solved my underlying problem another way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts