I want to add custom methods to an Excel Sheet:
Option Explicit
Implements IReadable
'Get the fields as defined on the sheet
Public Function getFields() As Variant
'test
Debug.Print Me.Name
End Function
I want to add them to the sheets explicitly and call them from outside the sheet.
After adding a bunch of decorators and utility classes, the number of modules already starts to rise (there are no packages / subfolders in VBA I'm aware of (?)).
It makes sense to abstract logic related to the sheet within the sheet itself instead of creating yet another custom module for it.
Is there a way that I can do something like:
dim oSheet as IReadable
set oSheet = thisworkbook.sheets("someSheet")
oSheet.getFields()
This doesn't work, because the Excel sheet object itself doesn't expose this method. Yet, I'd really like to add public methods of my own that I can call from outside the Sheet module.
Thanks
Edit: I guess that I could trigger an event or something of that kind, but that smells like pretty dirty stuff...