vba 向标签添加滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5667403/
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-11 13:01:36  来源:igfitidea点击:

Adding a scroll bar to a label

excelvbauserform

提问by Mike

I have a label on a userForm and the data within it is in list form. The data is longer than the label. Without expanding the label, is there a way to add a scroll bar to it? Or is there another option? Basically I want a box that does not have a scroll bar unless the list is longer than the box, then there's a scroll bar.

我在 userForm 上有一个标签,其中的数据采用列表形式。数据比标签长。在不展开标签的情况下,有没有办法为其添加滚动条?或者还有其他选择吗?基本上我想要一个没有滚动条的框,除非列表比框长,然后有一个滚动条。

Using Excel vba userForm

使用 Excel vba 用户窗体

回答by Tim Williams

You can used a textbox styled to look like a label. Set it to multiline with scrollbars set to vertical. Scrollbars will only show up if the content exceeds the size.

您可以使用样式看起来像标签的文本框。将其设置为多行,滚动条设置为垂直。滚动条仅在内容超过大小时才会显示。