Listbox Auto Column Width

T

Trevor Williams

Hi All

Is it possible to 'autofit' column widths in a ListBox built from the
Control Toolbox?
If so, can you point me in the right direction.

Thanks

Trevor Williams
 
J

JLGWhiz

This from the VBA help file:

To separate column entries, use semicolons (;) as list separators. In
Windows, use the list separator specified in the Regional Settings section
of the Windows Control Panel to change this value.

Any or all of the ColumnWidths property settings can be blank. You create a
blank setting by typing a list separator without a preceding value.

If you specify a -1 in the property page, the displayed value in the
property page is a blank.

To calculate column widths when ColumnWidths is blank or -1, the width of
the control is divided equally among all columns of the list. If the sum of
the specified column widths exceeds the width of the control, the list is
left-aligned within the control and one or more of the rightmost columns are
not displayed. Users can scroll the list using the horizontal scroll bar to
display the rightmost columns.

The minimum calculated column width is 72 points (1 inch). To produce
columns narrower than this, you must specify the width explicitly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top