I wrote a couple of times last week about custom tags and creating a class that could store custom tag information. I am further refining the requirements of the class using a real world example of something I will be using it for.
I’m bringing in an enum here that is being used inside the Form Resizing class that will end up utilizing these custom form fields. Here is the enum code:
An enum is creating a set of numeric values from string names. I setup this sub in the class to print out the enum:
And in the immediate window I can setup and print the enum like this:
So you can see the enumeration simply starts at 0 (because FromLeft was set to 0 in the definition) and then by default VBA just adds 1 for each additional defined element.
This is used to pull an element from the control’s tag property, split it into an array, and then access that particular array element.
I would like for this new custom tag class to simplify the process. So what is the process? How is the existing tag being set and called? With the following code:
And now my idea from a couple of days ago has evolved a bit to become something like this:
This syntax feels simple and usable to me. I think it could really simplify the existing code. So now I get to sleep on it once more and see what happens. A quick note, it does feel a little clunky having to use the ctl as a parameter and I’d love some solution as well that would have some kind of autocomplete, but maybe that would be for another iteration, if it would even be possible.
Trackbacks/Pingbacks