+ Reply to Thread
Results 1 to 8 of 8

Using change event for combo box created at runtime (VB6)

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Using change event for combo box created at runtime (VB6)

    ComboBox_Change Event in Controls.add

    Hi,

    I am a newbie to this forum and VB. I have gained some experience in creating combo boxes. I am facing a problem with combo box created at runtime. I am not able to figure out the firing of combo_Change event in this case, since the variable name (or should i say object?) of the new combo box is created at runtime.

    In UserForm code, I have added a new combo box at runtime

    Please Login or Register  to view this content.
    On UserForm
    The combo is displayed.
    How can I set the Combo_Change event procedure in UserForm coding?

    Thanks in anticipation.

    PS: Related unsolved thread: http://www.excelforum.com/excel-prog...trols-add.html
    Last edited by camphor; 06-12-2012 at 04:25 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,054

    Re: Using change event for combo box created at runtime (VB6)

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using change event for combo box created at runtime (VB6)

    Sorry for the inconvenience. Edited the code portion.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Using change event for combo box created at runtime (VB6)

    Have a look here, it's a bit more complex than you need, but it is exactly the same principle

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using change event for combo box created at runtime (VB6)

    Hello, Thanks for the reply.

    Unfortunately I could not understand much from the link. If possible could you simplify the implementation for me, considering i am new to vb and excel. Thanks in advance

  6. #6
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Using change event for combo box created at runtime (VB6)

    Hi camphor,
    Have a look at the sample workbook.
    Note that i have changed your code as it will put all combo-boxes (i assume there will be more than one on the form) one over another.
    Buran
    Attached Files Attached Files
    If you are pleased with a member's answer then use the Star icon to rate it.

  7. #7
    Registered User
    Join Date
    06-11-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using change event for combo box created at runtime (VB6)

    Hello, thanks for the prompt reply. I would further build on this code and hopefully I would proceed in my implementation.

  8. #8
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Using change event for combo box created at runtime (VB6)

    Great! You may find useful to look at this http://www.cpearson.com/Excel/Classes.aspx as a basic reference for use of own class

+ 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