[RESOLVED] [VBA] Question about Classes, Should I use one in this situation?
I have 3 subs/functions I created so that I'm not re-writing the code to take a sql statement, and add it to a listview.
The 3 subs are
- udfFormatListView
- udfCreateListViewHeaders
- udfPopulateListview
vb Code:
udfFormatListView(ByRef MyListView as Listview)
udfCreateListViewHeaders(ByRef MyListView as ListView, ByVal strSQL as String, Optional ByVal HideFirst As Boolean = True) AS Long
udfPopulateListview(ByVal MyListView As ListView, ByVal strSQL As String) As Long
I put them in a class, but by themselves, it seems kind of a waste of using a class.
Should I just use a module instead? What else could I add to the class to make it worth being in a class?
I was going to include constant values to define types of errors that could be received back from the functions.
When I am complete I was going to submit the class to possibly be added to the Codebank.
Re: [VBA] Question about Classes, Should I use one in this situation?
IMHO if you do not need to create a new instance of an object then standard module would of course be a "better place" for all of your common functionality.
You can even share your module between multiple projects.
Re: [VBA] Question about Classes, Should I use one in this situation?
Awesome, I think I was just trying to get too fancy with it ;p
Thanks RhinoBull