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 6803069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:17:59+00:00 2026-05-26T19:17:59+00:00

I’m trying to extend functionality of the VBA Collection object in a new class

  • 0

I’m trying to extend functionality of the VBA Collection object in a new class and make this class an inheritant of Collection, but the Implements Collection statement gives me the following error:

Bad interface for Implements: method
has underscore in its name.

What underscore?! Add, Item, Remove, and Count are the only methods listed in the documentation for Collection. All four are underscore-free.

EDIT: To clarify, I’m making a class called UniformCollection (that only accepts members that are all of the same type, inspired by this approach). I’d like it to implement Collection, so that a UniformCollection is a Collection and can be used in place of a Collection when calling other objects’ methods, etc.

I know I have to write delegating methods/properties for Add, Item, etc., and a NewEnum property for For Each to work, and I’ve done so already.

My problem is that the Implements Collection statement gives me the error stated above.

Bonus question: is Count a method or a property of Collection? Help calls it a property, but the Object Browser in the VBA editor calls it a function i.e. method (flying yellow box).

  • 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-05-26T19:17:59+00:00Added an answer on May 26, 2026 at 7:17 pm

    You are running into one of the limitations of Implements in VBA. You can’t implement another class if the other class has any public methods or properties with an underscore in the name. Collection class of course has _NewEnum but any underscore will cause a problem.

    For example, if you created a class AddressClass that had the following:

    Public Address_City As String
    

    Then created another class CustomerAddress:

    Implements AddressClass
    
    Private Property Get ClassInterface_Address_City() As String
    End Property
    
    Private Property Let ClassInterface_Address_City(ByVal RHS As String)
    End Property
    

    When you compile, you will get an error “Object module needs to implement ‘Address_City’ for interface ‘AddressClass’.” Changing the property to AddressCity makes the error go away.

    Possible solution: If I understand correctly, you want to implement the collection class so you can pass your new class to methods that take in collections as parameters. Is it possible to alter those methods? My suggestion would be to create your own collection class MyCollection and then implement it instead. i.e. UniformMyCollection That way you can completely avoid problems with underscores.

    As for Count, I would trust the Object Browser over the help text anytime. On the other hand, if you are creating your own collection class, it doesn’t matter which one you choose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.