vba 删除列表框上的滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5638129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 11:21:41  来源:igfitidea点击:

Remove the scroll bar on a list box

excelvbauserform

提问by Mike

I'm using a userForm in vba and I have a list box. I want to remove the horoz. scroll bar from the bottom. Is there a way to do this? I don't see any option in the properties box.

我在 vba 中使用 userForm,我有一个列表框。我想删除horoz。从底部滚动条。有没有办法做到这一点?我在属性框中没有看到任何选项。

enter image description here

在此处输入图片说明

回答by Fink

This can occur when you have the column width format property of the listbox set to something wide, then you size the control to the data, it will show the scroll bars.

当您将列表框的列宽格式属性设置为宽时,就会发生这种情况,然后您将控件的大小设置为数据,它将显示滚动条。

To fix this, change the "Column Width" property under the format tab to something really small, then play around with this property and the size of the listbox control until you get it how you want, and no scroll bars are displayed.

要解决此问题,请将格式选项卡下的“列宽”属性更改为非常小的值,然后使用此属性和列表框控件的大小,直到获得所需的大小,并且不显示滚动条。

回答by DJ Burb

Try making the listbox a little wider.... not mucn wider, but just enough to get rid of the horizontal scroll bar.

尝试使列表框更宽一些......不是 mucn 更宽,但足以摆脱水平滚动条。

Maybe that will work.

也许那会奏效。

回答by Jim Guess

Click on the Userform. Under the Property Stats, look for KeepScrollBarsVisible.
Change it to 0 - fmScrollBarsNone

单击用户表单。在 Property Stats 下,查找 KeepScrollBarsVisible。
将其更改为 0 - fmScrollBarsNone

I was working with this for two hours - trying to find the answer in the ListBox. It is NOT there!

我为此工作了两个小时 - 试图在 ListBox 中找到答案。它不存在!

Jim

吉姆

回答by Jan Soukup

I declared columnwidth in start of form and it works like a charm!

我在表单的开头声明了 columnwidth ,它就像一个魅力!

回答by Patrick Lepelletier

You need to set the property ListWidth of the listbox or combobox bigger than the property ColumnWidth.

您需要将列表框或组合框的属性 ListWidth 设置为大于属性 ColumnWidth。

The first beeing the size of what you show on screen, and the second beeing the size of what you want to put inside the first.

第一个是您在屏幕上显示的内容的大小,第二个是您想要放入第一个内容的大小。