Results 1 to 3 of 3

Thread: [RESOLVED] [VBA] Question about Classes, Should I use one in this situation?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    Anchorage, Alaska
    Posts
    545

    Resolved [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

    1. udfFormatListView
    2. udfCreateListViewHeaders
    3. udfPopulateListview


    vb Code:
    1. udfFormatListView(ByRef MyListView as Listview)
    2. udfCreateListViewHeaders(ByRef MyListView as ListView, ByVal strSQL as String, Optional ByVal HideFirst As Boolean = True) AS Long
    3. 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

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    Anchorage, Alaska
    Posts
    545

    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
  •  



Click Here to Expand Forum to Full Width