+ Reply to Thread
Results 1 to 7 of 7

ActiveX Combobox dropdown 'reset' when repopulating

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    ActiveX Combobox dropdown 'reset' when repopulating

    Hi all,

    OK, I know my description might be weird, but the case is this -

    I have an activeX combobox, that, when people start typing and write more than 3 characters, will look online for matches to populate the combobox with.
    At fist I clear the list (combobox1.clear), then add a "Pulling data, please wait" (combobox1.additem("Pulling")) and dropdown so it shows that - (combobox1.dropdown).

    Then when the results come back, I clear the combobox and add the result items - this works all fine, but...
    The "dropdown" shows only 1 line with selection arrows up/down in the dropdown. If I close the dropdown and open it again, it shows multiple lines.
    However - I don't know how to programmatically close the dropdown. Is this possible?
    Combobox1.dropdown doesn't seem to be a boolean, it's just 'drop it down' and there's no Combobox1.close - if I reset focus, the dropdown stays visible.

    Does anyone know how to 'reset' the combobox dropdown so it shows multiple lines after it's been populated with results... ?
    Thanks!

    Jasper

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    Jasper

    How are you initially populating the combobox?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    Hey Norie,

    as follows:

    Please Login or Register  to view this content.
    It's an a-synchronous data pull, so on receiving the data I do this:

    Please Login or Register  to view this content.
    Last edited by JasperD; 04-27-2017 at 04:59 AM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    Why are you using the combobox's own Change event to populate the combobox?

    I've got a feeling these lines of code might actually be triggering the Change event.
    Please Login or Register  to view this content.
    So, as far as I can see, you have code in the Change event that's triggering, well, the Change event which has code that will trigger the Change event...

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    It actually works fine - as it shows "Please wait" until I populate it properly. However, the number of items shown is limited to 1 as 'please wait' is one - so what needs to be done is 'resetting' the dropdown...

    Try this for example:
    Please Login or Register  to view this content.
    It will show "Please wait..." for 5 seconds, before clearing the dropdown values and inserting the correct ones (1-10). However, only the '1' shows. Closing and re-opening the dropdown will show multiple items.

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    OK, I've figured it out - I just quickly set the focus on another control and switch it back - to illustrate, the code below would work fine (after adding an option button and setting it invisible).

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: ActiveX Combobox dropdown 'reset' when repopulating

    Have you tried stepping through the code?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Detect click on dropdown arrow in an activex dropdown box
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2017, 08:23 AM
  2. Replies: 0
    Last Post: 10-26-2015, 04:25 PM
  3. ActiveX combobox datalist dependant on previous combobox selections
    By Mrs Poodle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2014, 07:07 AM
  4. [SOLVED] fill listbox (ActiveX) based combobox (ActiveX)
    By elsg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2014, 11:25 AM
  5. Reset Values Based on Dropdown
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2014, 01:45 PM
  6. Code to reset combobox dependant on another combobox
    By j.farr3ll in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-08-2011, 08:21 AM
  7. Populate a activeX combobox from a selection of another combobox
    By ptramel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-28-2009, 06:50 PM

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