ActiveX Combobox displays wrong number of lines

Posted on 2010-04-07
Medium Priority
Last Modified: 2012-05-09
I have a Combobox with the listrow set to 5 yet it displays three listrows.

Not only that but the range comprises five cells yet the drop down does not have the up/down arrow for scrolling so the bottom 2 can't be chosen.

If I'm pretty sure ActiveX controls are buggy if there is someone who can point me at something obvious then I'll be eternally grateful.

PS this Combobox used to refer to as the range that had a three cells and I also had the listrow property set to three, somehow the changes just don't seem to carry through although the data presented in the drop down is from the new range even though the drop down is the wrong length and also cannot access the bottom two members of the five member data set.

To cut a long story short.
The range the box refers to refers to another range
the information from that incorrectly referred range makes it into the ActiveX control.
The control seems to ignore its listrow property and doesn't make even scrolling an option to access further members of the data range.
Question by:sir plus
1 Comment

Accepted Solution

sir plus earned 0 total points
ID: 30096801
Okay I've solved it!
The listbox cannot refer to a range which is defined as referring to another named range.

It picks up the content of the range but not other parameters and somehow screws everything up.

If I have googled this like crazy and spent a day on it, this is repeatable and I will report to Microsoft.

Contrary to popular opinion I found that they do care and reporting this stuff results a fix for the next version or patch.

        With ComboBox2
        .ListFillRange = Range("gListReturnAir2").Address
        .Locked = False
        .ListRows = Range("gListReturnAir2").Rows.Count
        .Locked = True
    End With
And I could use this if I wanted to still referred to a defined name instead of an actual range on the sheet.

The following also works if you want to keep the listbox referring to a more meaningful named range:

Dim sNameRange As String
    sNameRange = Right(ThisWorkbook.Names("gListReturnAir2").RefersTo, Len(ThisWorkbook.Names("gListReturnAir2").RefersTo) - 1)
    With ComboBox2
        .ListFillRange = ThisWorkbook.Names(sNameRange).RefersTo
        .Locked = False
        .ListRows = Range("gListReturnAir2").Rows.Count
        .Locked = True
'        .Locked = bComboBoxLockedState
    End With

I will give the points to me on this one unless someone answered it before I hit the submit button on this post

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question