View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default ComboBox listwidth to match text in list

If you want the size of the list box to change with each time chosen that
that is not to bad. Using a combo box from the Control Toolbox change the
AutoFit Property to True.

If you want to set the size of the box to be as long as it need to be for
the longest entry then that is more difficult than it sounds. The problem
arises because by default you are probably using a proporational font like
Tahoma or Arial where the with of each character varies. Based on that it is
very difficult to know which is the "longest" entry and what the required
width is. If you Switch to courier or some other non-proportional font then
you can determine the length of each character based on the font size and
proportion your width accordingly. My suggestion for this is to just make the
Box as big as you reasonably can...
--
HTH...

Jim Thomlinson


"J.S.Winstrom" wrote:

I am having some trouble in finding information on how to set the
listwidth/columnwidths in a combobox to match the text longest entry. Any
help would be greatly apreciated!

~J.S.Winstrom