简体   繁体   中英

how to create a search suggestion ComboBox in User form vba excel

ComboBox下拉列表显示的是下拉订单项,是否有任何选择让ComboBox显示动态(搜索建议)?

Yes, it is possible as I did it in the past. What you need is:

  1. capture keypress event in excel application
  2. get the currently edited cell's value
    • To do this, you must do a following hack: 2.1. Save content of the clipboard into a variable 2.2. Send programmed Ctrl-A and afterwards Ctrl-C keypress 2.3. Save content of the cliboard as second variable 2.4. Load content of first variable back to the clipboard 2.5. Use second variable's content int the next step.
  3. dynamically create a collection based on the value
  4. put that collection as the new combo box value list
  5. show the list to user (unfold combobox)

EDIT: 2nd point requires a "hack". Added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM