|
-
Nov 25th, 2009, 05:57 PM
#1
Thread Starter
Fanatic Member
[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.
Please RATE posts, click the RATE button to the left under the Users Name.
Once your thread has been answered, Please use the Thread Tools and select RESOLVED so everyone knows your question has been answered.
"As I look past the light, I see the world I wished tonight, never the less, sleep has come, and death shall soon follow..." © 1998 Jeremy J Swartwood
-
Nov 25th, 2009, 07:21 PM
#2
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.
-
Nov 25th, 2009, 07:29 PM
#3
Thread Starter
Fanatic Member
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
Please RATE posts, click the RATE button to the left under the Users Name.
Once your thread has been answered, Please use the Thread Tools and select RESOLVED so everyone knows your question has been answered.
"As I look past the light, I see the world I wished tonight, never the less, sleep has come, and death shall soon follow..." © 1998 Jeremy J Swartwood
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|