Series Overview: Tips and Tricks with VBA Classes

In their simplest form, VBA classes can create basic objects. By diving into advanced concepts, classes introduce some common features present in traditional object oriented programming languages. Overview This is the fourteenth and final post of the Tips and Tricks with VBA Classes series. This post acts as a summary …

VBA Interfaces: The Implements Statement

The VBA Implements statement permits the use of interfaces, a mechanism to build clarity and consistency between multiple classes. As VBA projects grow, interfaces can be a central component of how a developer interacts with classes and custom objects. Overview This is the twelfth post in the Tips and Tricks …

VBA Inheritance: Custom Objects as Class Properties

Inheritance is a concept that permits the transfer of data from one class to another class. While common in many programming languages, it is not native to VBA. In the absence of true inheritance, effective coding can help mimic its behavior.

Storing Objects as Class Properties

In most situations, Excel objects, such as shapes and buttons, perform simple functions and stand on their own. However, when stored within a class, the opportunity exists to supplement the functionality of custom objects.

Storing Arrays as Class Properties

There may be situations where a single class property is needed to store multiple values. This can support a list of data or provide the foundation for a loop. VBA classes provide the framework to store arrays as class properties. Overview This is the ninth post in the Tips and …

Sorting Objects of a Collection Class

One feature noticeably absent from VBA is a built-in function to sort arrays and collections. The bubble sort is a well known technique for sorting groups of elements when no native function exists. With a few minor adjustments, a bubble sort can also be used to sort collections of custom …

Using Class Initialize in Collection Classes

Class Initialize is known as an intrinsic (native) procedure that triggers when a custom object is initialized. Did you know that this procedure will also work within collection classes? When used properly, class initialize can help set up collections by using default data or loading from saved data.

Saving Custom Object Data in a Workbook

Previous posts have discussed advantages to using custom objects and custom collections. When used as globals within a VBA, custom objects provide a means of storing complex data structures outside of a standard worksheet. The efficiency gains and ease of access can help you build robust programs. Unfortunately, these custom …

Using Custom Keys in Collection Classes

Accessing a specific object within a collection class can be a challenging endeavor. By assigning a proper custom key to objects in a collection class, you can avoid the often cumbersome error handling and loop searches often used to retrieve objects.