+ Reply to Thread
Results 1 to 3 of 3

ActiveX ComboBox: Almost there!!!

  1. #1
    Registered User
    Join Date
    09-15-2006
    Posts
    15

    Arrow ActiveX ComboBox: Almost there!!!

    Hello all,

    I posted my ActiveX ComboBox question a few days ago (I've included my original message below). Basically, I have a combo box with items:

    Space(Null String)
    Item 1
    Item 2
    Item 3
    Item 4

    I need:
    Space(NS)
    Item 1 Renamed
    Item 2 Renamed
    Item 3 Renamed
    (Item 4 removed)

    I was able to use the following VBA code, which renamed (but also duplicated) the items and also stalled my computer a few times:

    1 Sub ComboBox3_Change()

    2 ComboBox3.AddItem "", 0
    3 ComboBox3.AddItem "Item 1 Renamed", 1
    4 ComboBox3.AddItem "Item 2 Renamed", 2
    5 ComboBox3.AddItem "Item 3 Renamed", 3
    6 ComboBox3.RemoveItem 4
    7 ComboBox3.Style = fmStyleDropDownList
    8 ComboBox3.BoundColumn = 0
    9 ComboBox3.ListIndex = 0

    10 End Sub


    Another variation I tried was to remove all items individually i.e line 6 repeated for all the items (0-4) first, then lines 1-5,7-10 following that. I also had ComboBox3.Clear precede the above chunk of code (line 6 excluded).

    The solution doesn't seem too far away...

    Any ideas would be appreciated!

    Thanks!

    Alex


    >Original message:
    >Hello all,
    >
    >I have an ActiveX combo box which has four drop-down items; one of the >items was misspecified and I simply need to change the text - the combo >box functions perfectly otherwise.
    >
    >Now, I was able to modify the text in design view - the problem is, once I >left the design view, my drop-down items remained unchanged.
    >
    >If anyone has any pointers on this, that would be great!
    >
    >Thanks in advance,
    >
    >Alex

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Response

    Have you tried working from the bottom of the list upwards instead of from the top of the list downwards. This way there shouldn't be any duplication of indexes. Maybe this will help.
    Martin

  3. #3
    Registered User
    Join Date
    09-15-2006
    Posts
    15
    Hi Martin,

    First off, thanks for the response. This one definitely has me stuck.

    I tried populating the list upwards, but unfortunately the code still stalls my computer and/or results in list items being added on instead of replaced.

    Alex

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1