with Custom Class

To control what type of objects are placed into a collection, you can create a collection class.
Using a class gives you the ability to create custom replacements for the standard Add, Remove, Count and Item methods.
You can create a class that "wraps up" your collection and then provide the equivalent methods and properties to emulate the buit-in collection object.


Disadvantages

You will loose the default Item method, meaning that you must use the full syntax.

You will loose the ability to use a For-Each-Next loop (or enumeration functionality).


Class - colStringDataType

Create a new class module called "colStringDataType".

Here is the code that uses this collection.
This collection can only contain text values and adding something that is not a string will generate an error.


class_Employee


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext