Consulting

Results 1 to 4 of 4

Thread: Solved: Combobox popup window without scroll bars

  1. #1

    Solved: Combobox popup window without scroll bars

    Is it possible to get rid of scroll bars in combobox? In other world I want to have a full view of all items then choosing them from combobox.

    The problem is that items in combobox are quite long, so they are cutted even with scroll bars.

  2. #2
    It's fine now. It was just about playing with properties of combobox and reducing number of lines to be written to the combobox's items.

    Part of code:
    [vba]UserForm1.Controls("ComboBox" & d).ColumnCount = 2
    UserForm1.Controls("ComboBox" & d).ColumnWidths = 20
    UserForm1.Controls("ComboBox" & d).ListWidth = 400
    UserForm1.Controls("ComboBox" & d).ListRows = list
    UserForm1.Controls("ComboBox" & d).Clear
    For i = 0 To (list - 1)
    If LTrim(Mylist(i, 0)) <> "" Then
    UserForm1.Controls("ComboBox" & d).AddItem
    UserForm1.Controls("ComboBox" & d).Column(0, i) = Mylist(i, 0)
    UserForm1.Controls("ComboBox" & d).Column(1, i) = Mylist(i, 1)
    Else: Exit For
    End If
    Next i[/vba]
    But I still can't understand how to set all columns width independent since error appeard on such a code:
    [vba] UserForm1.Controls("ComboBox" & d).ColumnWidths = 20; 40[/vba]

  3. #3
    VBAX Mentor tstav's Avatar
    Joined
    Feb 2008
    Location
    Athens
    Posts
    350
    Location
    The value assigned to .ColumnWidths must be a string
    [VBA]UserForm1.Controls("ComboBox" & d).ColumnWidths = "20;40"[/VBA]
    He didn't know it was impossible, so he did it. (Jean Cocteau)

  4. #4
    Quote Originally Posted by tstav
    The value assigned to .ColumnWidths must be a string
    [vba]UserForm1.Controls("ComboBox" & d).ColumnWidths = "20;40"[/vba]
    Oh, I'm stupid, that's quite evident! Thank you =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •