In my last week’s Blog post I elaborated on data types and their use in VBA.
Beyond using the readily available native data types we’re all familiar with, such as Integer, Date, String and Boolean, we can define our own, user-defined data type.
Simply put, a user-defined data type is a group...
A data type is a structure to store data with given attributes and constraints.
You are probably familiar with some popular data types defined for us in VBA, such as an Integer, String and Date.
An Integer in VBA, for example, is allocated with 2 bytes to store numbers in the range -32,768 to 32,767.
A Date in VBA is allocated with 8 bytes to store numbers representing date and...
A collection is a stack of objects of the same type, “chained” one after the other.
As you add an object to the collection, it assumes the next index in sequence – added as the next “link” in the “chain”.
The collection is an easy to use data structure. It requires no declaration of the anticipated size of the “chain” in advance....
Simply put, enumeration is about naming sets of related constant numbers.
You probably already worked with enumerations. For example, the Application.Calculation property is numeric. It holds a number representing the calculation mode of Excel. Possible values for this property are:
In Part 1 on this exercise of implementing OOP in Excel VBA, we left off with a half-baked order object. It had some properties and a couple of methods, but its line-items were missing.
Today we’re going to round up our order object to include its line-items.
Thinking about the right structure and arrangement of the line-items within the order object, two main characteristics should guide our thinking:
After we covered in detail what OOP is in last week’s Blog post, we’re ready to see how this works in Excel VBA.
The key concept to keep in mind as we implement objects in Excel VBA, is that we are creating our own custom objects, on top of the available objects at our disposal out of the box.
The image here shows a list of the available properties and methods of the Workbook object.
This list is the exposed interface of the...
In order for you to understand this article, you need to know what an Object in computer programming is. Lucky for you, I just wrote about it last week.
There are two dominating programming paradigms out there.
The basic concept is that of statements organized in modules and functions, executed in order.
Typically, there is a main...
Simply put, an object is any “thing” you can actually see, physically.
For example, a person, a car, a pencil, a circle – are all physical objects.
Extending our perception of object to understand how objects are used in computer programming, an object can also offer a well-defined service: A Government...
In one of my customer’s project that manages trainings and certifications, employees receive email and SMS notifications on various events: upcoming training reminders, training result (with a certificate attached), change of instructor, training assessment reminders etc.
The technique for doing that is using a queue. All notifications...
In my Blog post from last week In which I elaborated on writing VBA code that runs on both Office 32-bit and Office 64-bit, we ended up with a challenge. We need to include the PtrSafe and LongPtr qualifiers in external libraries declarations for Office 64-bit, but ignore these qualifiers in Office 32-bit environments (where they are unknown).
Today I’ll explain all about VBA’s pre-compiler...