设置组合框的一些属性(滚动、编辑、跳转)
我想为一些 VBA 表单组合框设置 3 个属性,但我不知道是否可行。 我不想让组合框可编辑。现在,如果用户在其中输入内容并提交表单,它将发送该值...我想让他仅从我在组合框中添加的值中进行选择。 我想让组合框中的项目列表可滚动。现在,如果使用滚动条,我可以滚动列表,但我不知道为什么不能使用鼠标滚动来滚动。 如果我开始打字,我想跳到某个项目。假设我在一个组合框中有一年中的月份...如果我开始输入 mar 我希望它跳到三月。我知道对于 html 表单来说,这个属性是默认的,但我不知道 VBA 表单... 多谢
There are 3 properties that I want to set for some VBA form comboboxes and I don't know if it's possible.
I don't want to let the combobox editable. Right now if the user types something in it that it submits the form it will send that value... I want to let him choose only from the values I added in the Combobox.
I want to make the list of items in the combobox scroll-able. Right now I'm able to scroll through the list if I use the scroll-bar but I don't know why I can't scroll with the mouse scroll.
And I want to jump to some item if I start typing. Let's say I have the months of the year in one combobox... if I start to type mar I want it to jump to march. I know that for the html forms this properties is by default but I don't know about VBA forms...
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您想要的行为中,有些可以通过组合上的设置实现,其他则需要对
.RowSource
设置为该范围.MatchEntry = fmMatchEntryComplete
和.MatchRequired = True
.ControlSource
设置为单元格地址(最好是命名范围)静默拒绝无效条目的示例代码
Of the behaviours you want, some are possible with settings on the Combo, others you will need to code
.RowSource
to that range.MatchEntry = fmMatchEntryComplete
and.MatchRequired = True
.ControlSource
to a cell address (preferable a named range)Sample code to silently reject invalid entries
将组合框的属性 MatchEntry 设置为 1 (fmMatchEntryComplete),并将 MatchRequired 设置为 true,例如
[] 的
Set the propertie MatchEntry of combobox to 1 (fmMatchEntryComplete) and MatchRequired to true for example
[]'s