Things You Can’t Do
If you are familiar with an object-oriented programming language such as Java or Visual Basic .NET you might be waiting for me to discuss constructors, inheritance, and overloading. You’ll have a long wait, because Excel’s Visual Basic can’t do any of those. There are also some limits on things you might assume you can do from looking at the Excel objects. For instance, you can’t create default properties. Table 5-1 lists these language limitations and provides some detail.
Table 5-1. Object-oriented features not available in Excel
|
Feature |
Limitation and workaround |
|---|---|
|
Constructors |
Only a default constructor is available. If you want to initialize an object, you must implement an |
|
Destructors |
Only a default destructor is available. If you want to free nonmemory resources used by an object, you must implement a separate |
|
Collection types |
There is only one collection type: |
|
Default properties |
Not available in custom classes. Properties must be called by name. |
|
Inheritance |
Not available. You can’t base one class on another. |
|
Interfaces |
Not available. You can’t create a prototype for a class. |
|
Overloaded methods |
Not available. Use the |
I include Table 5-1 because it’s hard to know what’s missing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access