Intro/Background (Feel free to skip if makes it harder to follow)
I have this hobby project which, due to complexity & number of subprocedures, I found I was adding a lot of global variables (to avoid repeatedly passing these as arguments down the subprocedure tree).
As the number of global variables grew, they became difficult to manage so I converted them into user-defined types. This worked great for keeping related variables together and intellisense.
Then I found that some were repeatedly using the same base functions so I thought I should look at converting these UDTs & functions into a class. (I am new to classes & OOP. On the other hand I have been creating complex user forms for years so I do have some understanding of encapsulation & get/set/let properties etc.)
The Problem
I converted my primary UDT into a class. Only to discover that doing this broke all the UDTs that were nested in this UDT. Online searches taught me that I can't have a public UDT inside a class.
What I think I need to do is to convert these "sub" UDTs into "sub-classes" of the new class - if such a thing is possible in VBA? I have come across the word "Implements" in VBA & Classes which sounds promising but I don't know if this is what I need?
If it helps, I have included an extract below of my 'before' code. When I convert THISMACRO to a class, it breaks the dependent/nested UDTs THISMACROSETUP and THISMACRORESULTS.
Please Login or Register to view this content.
Bookmarks