+ Reply to Thread
Results 1 to 14 of 14

Creating my own combobox class

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2010
    Location
    Springfield, IL
    MS-Off Ver
    Excel 2007
    Posts
    36

    Re: Creating my own combobox class

    Well, thats awesome! Thank you! However, I'm unsure of why that works. May I ask you some questions?

    1) is it necessary to put the sub HookCombos in the sheet class? or wouldn't it do just fine being in a module, substituting the "me." for "Worksheets("yadayada")."?
    2) why do you need to add all the created objects (objhandler) into a collection? you say so that they don't lose focus... what does that mean?
    3) i dont understand how the code in the class module (ccombohandler) is complete. the only thing done was to declare a variable, and then an example of event code. Nothing was done for "Combo". What about setting "Combo" equal to something in the class module...?
    4) i dont understand how this works: "Set objHandler.Combo = objOLE.Object". How does that NOT overwrite the class module, replacing it with the actual object objOLE.Object?

    Thank you!
    Im sorry for my questions. Class modules are still so very confusing for me.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,136

    Re: Creating my own combobox class

    1. It would be fine in a module, but as it is sheet specific, I put it in the sheet.
    2. The variables are declared and created in the HookCombos routine, which means that if you don't store them somewhere (an array would also work) they would lose their values when the routine ended.
    3. Assigning an actual combo box to the class happens in the HookCombos routine. Remember that the class is really just a blueprint; you are simply saying that the class will have a combo box and you want to respond to its events.
    4. It does assign the actual combo to the class' combo variable - that's why you can intercept the events for that actual combo box.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    11-13-2010
    Location
    Springfield, IL
    MS-Off Ver
    Excel 2007
    Posts
    36

    Re: Creating my own combobox class

    I'm still not understanding how the variable "combo" can be functional. In classes, it seems, when you dim a variable, you then have to do something with that variable (use it in a property or procedure) so that when it is used as an object later (objHandler.combo) the software knows what to do with it.

    But in the class module, the only code that for the combo variable is a public statement. So how does the software know what to do with it? What DOES the software do with it?

    Thank you for your continued help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1