Force redraw on ActiveX ComboBox or call ComboBox_DropButtonClick from a module

ButtFace

Board Regular
Joined
Oct 16, 2015
Messages
64
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

Created an ActiveX ComboBox with search suggestions that automatically refilters ("shrinks") as the user types (KeyUp event). The ComboBox is "floating" and sizes/positions itself depending on whether or not the ActiveCell intersects certain rows/columns.

I've noticed that whenever the ComboBox is repositioned and I call the .DropDown method, the DropDown list appears where the ComboBox *used* to be and not at it's current location. I've tried to workaround this by selecting the last active cell and then reactivating the ComboBox but this doesn't always appear to correct the problem and results in a lot of "flickering" since it's deactivating/reactivating the ComboBox with every keystroke (because it fires on the KeyUp event).

Additionally, sometimes the ListItems (including the scroll bar) are all squashed into a single row of the ComboBox. Clicking the drop down button again correctly places the list and populates the list to the correct .ListRows.

Is there a cleaner method to force a redraw of the ComboBox object? E.g., maybe calling the ComboBox_DropButtonClick event from a module?
 

Attachments

  • FunkyBox1.png
    FunkyBox1.png
    5.8 KB · Views: 5
  • FunkyBox2.png
    FunkyBox2.png
    3.8 KB · Views: 5
  • FunkyBox3.png
    FunkyBox3.png
    2.6 KB · Views: 5
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,578
Messages
6,173,167
Members
452,504
Latest member
frankkeith2233

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top