How to disable only the horizontal scroll bar in an Excel 97 vba list box in a frame.


Posted by Kurt on November 17, 2000 11:50 AM

Hello everyone,

How would I go about disabling the horizontal scroll bar in a list box inside of a frame in Excel 97 vba. I only want to see the Vertical scroll bar.

I can use several columns or just one.

Any help would be greatly appreciated.

Kurt

Posted by Newby on November 19, 2000 7:55 AM

Go to tools==> options and unselect the thing
u don't need



Posted by Tim Francis-Wright on November 20, 2000 11:32 AM

VBA shows the horizontal scrollbar if the
column widths in total are wider than the
listbox. If you don't need to change
these dynamically, the easiest way is through
the properties dialog (right-click on the listbox
in the VBA environment).

You have two options:
Set the .ColumnCount property of the listbox
to 1, and set .ColumnWidth to -1 or blank, which will make VBA show what it can of the items in the
listbox, even if they're too wide.

Set the .ColumnCount property to some other number; and then set the .Width and .ColumnWidths
properties so that the columns--and the vertica;
scrollbar, if there is a large enough set of
entries--all fit in the desired width.

For example, a listbox with
.Width 150 (points) and .ColumnCount 3
could have .ColumnWidths set to 75pt;25pt;45pt
and avoid the pesky horizontal scrollbar (the
extra 5 pts cover the width of the vertical
scroll bar).

HTH