Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9256801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:02:57+00:00 2026-06-18T12:02:57+00:00

I have created a Collection of objects in VBA and each object has a

  • 0

I have created a Collection of objects in VBA and each object has a unique ID. I understand I can access the ‘items’ in a collection which is an inbuilt function of VBA. Is there a way I can access the object’s id? (i’m not sure how to set up the loop..

Currently I am doing something like:

For each objectName in CollectionName

objectName.Item(index)

Next objectName

This is correct syntax for accessing the collection’s Item, but I am unable to delve into the collection to get the object’s/item’s ID…is this possible?

fyi, the object’s id is set up as mID and is an integer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:02:59+00:00Added an answer on June 18, 2026 at 12:02 pm

    Unfortunately, the Collection class does not offer an iterator for the IDs. 🙁

    If you want this, use a Dictionary object instead! It is part of the `Microsoft Scripting Runtime’ (to be selected in Tools->References) – and works like a Collection – but with a lot of additional functionality.

    Here’s an example:

    Public Sub TestDictionary()
        Dim dict As New Dictionary
        Dim var As Variant
    
        dict.Add "Key1", 1
        dict.Add 2, "Item 2"
        dict.Add "Another key", "blabla"
    
        For Each var In dict.Keys
            Debug.Print var, dict(var)
        Next var
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataMapper::Collection Object. Each of it's entries has a created_at property. I
I have a collection of .html files created in the mid-90s, which include a
I have got an Entity model which contains a collection of Message objects which
I created a list<T> that contains a collection of objects that have this properties:
I have a class called Contacts which contains a collection of objects called PhoneNumbers
I have created a WCF service which returns IEnumerable<CyberResourceProvisioningAction> . The CyberResourceProvisioningAction type has
I want to maintain a collection of created objects of a Klass. I have
I have a series of objects I have created: Item Order Song etc. Each
I have created some business objects which are created with the data from the
I have a arraylist(eg.CustInfo) which contains a collection of objects(Cust_details,Cust_Auth) for java classes, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.