Results 1 to 10 of 30

Thread: Class Stuff: VBA Custom Classes & Objects, Class Modules

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Custom Classes and Custom objects. General and UserForms

    Custom Classes and Custom objects. General and UserForms


    We are approximately ¾ into the story and have reached the part which touches on the area often at the start of traditional explanations of these things. The previous discussions told us that we, when using Excel, are somewhere down from the true Class level, having access to objects already built from a Class which we had no direct access to.
    Excel VBA does allow us to start at the top, all be it with a limited possibilities in what we can achieve and do. We have two possibilities.
    The first starts with being able to add a code module which is at the level of a Class. This is misleadingly seen in the VB Editor as similar to the other modules, whereas its pseudo up a level , and is intended to be a Blue print / Template from which objects are then instantiated.
    To confuse us further , those instantiated objects , would have a similar place in the OOP hierarchy as those two object types discussed which we can see. But the object code modules we can effectively make from our custom class module, are not represented in the VB Editor.
    Having already made a confusing mess, as is typical with Microsoft, they like to take it further, and these unrepresented objects can be many, since we are free to instantiate as many objects from the Class as we choose.
    The second, a UserForm is a slightly different thing altogether, and we will only discuss some basics of this in particular things relevant to our general Class discussions, for completeness. ( For anyone familiar with the “ stand alone “ Form/Window applications of traditional Visual Basic, the UserForm is very approximately a similar idea for a semi independent Window type application , but within Excel , rather than anywhere within Windows, as with the traditional “ stand alone “ Form/Window of Visual Basic )

    Before discussing , further , some general notes specifically concerning the usefulness of using Class / Class modules, in particular the use of Class modules, ( not necessarily directly related to UserForms )…

    Some general discussions about the ( non ) usefulness of using Class / Class modules
    _ There is not much, if anything that can be done with Class Modules that can’t be done with normal VBA Functions. There is little if any, performance advantages. There is no increase in functionality or efficiency
    _ For somebody writing a lot of complicated coding it can help that person to both organise and later remember what you were doing. Related coding can be kept in the same place, and it helps make the coding self documenting. At the same time it makes the coding more difficult for someone else to follow and understand. So it is a useful tool to help you organise complicated long coding, and if you want to share and make it a bit more difficult for someone else to understand.
    Last edited by DocAElstein; 03-03-2021 at 01:41 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. PQ - IP C class generator
    By sandy666 in forum ETL PQ Tips and Tricks
    Replies: 0
    Last Post: 10-22-2020, 05:16 AM
  2. Backup all modules, class modules and userforms to a selectable folder
    By MrBlackd in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-06-2014, 08:33 AM
  3. Manipulate VBA Array Object Using Class Module
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 0
    Last Post: 06-06-2013, 07:53 PM
  4. Array Class Module
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 3
    Last Post: 12-20-2012, 11:22 AM
  5. Class Objects Created Using the CreateObject Method That Employs Late Binding
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-16-2011, 12:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •