有时ActiveX组合框仅显示一行,为什么? [英] Sometimes the ActiveX Combobox only shows one row, why?

查看:124
本文介绍了有时ActiveX组合框仅显示一行,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎当我第一次单击组合框然后单击箭头时,将显示所有项目。

It seems that when I first click on the combobox and then click on the arrow, all items are displayed.

当我单击箭头而未单击时之前的组合框,仅显示一个项目,我可以单击滚动按钮查看其他项目。

While if I click on the arrow without clicking on the combobox before, only one item is displayed and I can click on scroll buttons to see the other items.

为什么会这样?

这是我用来在组合框中填充项目的宏

Here is the macro I am using to populate the combobox with items

Private Sub ComboBox1_GotFocus()
    Dim c As Range
    Dim selText As String
    selText = ComboBox1.selText
    ComboBox1.Clear
    For Each c In wConfig.Range("BudgetDropdown").Cells
        ComboBox1.AddItem c.Value
    Next c
    ComboBox1.selText = selText
End Sub

推荐答案

要自动使用命名范围内的数据填充组合框,请将其 ListFillRange 属性设置为范围的名称。

To automatically populate combobox with data from named range, set it's ListFillRange property to the name of the range.

您可以在运行时执行以下操作:

You can do it at runtime:

ComboBox1.ListFillRange = "BudgetDropdown"

或通过将其设置为 BudgetDropdown 在属性窗口中。

Or by setting it to BudgetDropdown in properties window.

这篇关于有时ActiveX组合框仅显示一行,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆