+ Reply to Thread
Results 1 to 11 of 11

ListBox property .ItemsSelected and .ItemData are missing

  1. #1
    Registered User
    Join Date
    04-02-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2019
    Posts
    10

    ListBox property .ItemsSelected and .ItemData are missing

    Hi,

    I'm beginner at VBA. In a UserForm, I created a List Box called
    ListBox1
    with the following settings:
    MultiSelect: fmMultiSelectExtended

    The properties .ItemsSelected and .ItemData don't appear as options of the dropdown list of properties of the object
    Me.ListBox1
    . This was reported in a previous thread (excel-programming-vba-macros/1128844-no-itemsselected-property-available). However, there are many online use cases using these properties.

    I checked the following:
    • ListBox1 is a List Box: its name type displays as "ListBox" in the properties window (I even ran code to go through all controls of the workbook and Msg Box if a control's name is "ListBox"
    • According to thedocumentation (vba/api/access.listbox.itemsselected), the control's MultiSelect property is set to Extended. What's weird is that the sample code:
      Please Login or Register  to view this content.
      threw the error "User-defined type no defined" at
      As Form
    , which suggests that the documentation hasn't been updated.

    Could it be that these properties have been removed? If so, where can I find a list of all deprecated/removed properties/methods?

    Thanks
    Attached Images Attached Images
    Last edited by Kevin-S; 04-02-2020 at 04:15 PM. Reason: clarification of instructions

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,869

    Re: ListBox property .ItemSelected and .ItemData are missing

    Maybe I misunderstood your question but this is what I think:
    I think you're looking in the wrong place:
    It's a value of the MultiSelect property
    Attached Images Attached Images
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    04-02-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2019
    Posts
    10

    Re: ListBox property .ItemSelected and .ItemData are missing

    By "above properties" I meant .ItemSelected and .ItemData, sorry. I rectified it in my initial post
    Last edited by Kevin-S; 04-02-2020 at 04:06 PM.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    9,948

    Re: ListBox property .ItemSelected and .ItemData are missing

    The two properties you refer to are for Access not Excel.

  5. #5
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    18,133

    Re: ListBox property .ItemSelected and .ItemData are missing

    You are looking at Access documentation. I would expect a ListBox to be the same in Excel VBA as it is in Access VBA, but that may not be true. (I believe your thread title should refer to .ItemsSelected). I do not have Access so I can't check that.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  6. #6
    Registered User
    Join Date
    04-02-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2019
    Posts
    10

    Re: ListBox property .ItemSelected and .ItemData are missing

    Quote Originally Posted by Fluff13 View Post
    The two properties you refer to are for Access not Excel.
    Yes, how could I use them? I have Access 2019. Is it a matter of selecting the appropriate .dll in tools > references? Sorry, I'm beginner and.. you might have to state the obvious with me.
    Last edited by Kevin-S; 04-02-2020 at 04:21 PM.

  7. #7
    Registered User
    Join Date
    04-02-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2019
    Posts
    10

    Re: ListBox property .ItemSelected and .ItemData are missing

    Quote Originally Posted by 6StringJazzer View Post
    your thread title should refer to .ItemsSelected)
    Correct, I rectified the typo

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,869

    Re: ListBox property .ItemsSelected and .ItemData are missing

    Why don't you just use the Excel tools as they're meant to be used?
    Not all systems have Access included so it will make your file less compatible

  9. #9
    Registered User
    Join Date
    04-02-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2019
    Posts
    10
    Ok, so each 'tool' has their own environment. Coming from a Node.js background, when we need a prop/method we simply download the package and "require" it.

    Guess I have to create an Access DB..

    (Application runs locally, which means I don't need to consider compatibility at this stage)

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    6,869

    Re: ListBox property .ItemsSelected and .ItemData are missing

    Your game, happy coding

  11. #11
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    18,133

    Re: ListBox property .ItemsSelected and .ItemData are missing

    Anything you can do with ItemsSelected you can do another way in Excel. I do this all the time. What is it you want to do?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] code for listbox give could not set the list property . invalid property value
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2017, 10:22 AM
  2. [SOLVED] Very Quick Question: VBs ItemData & NewIndex
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2015, 10:15 PM
  3. [SOLVED] Invalid use of property - Listbox
    By Brumbot in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-20-2013, 09:05 AM
  4. ListBox property
    By matrixknow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2007, 02:17 AM
  5. Add custom property to a listbox?
    By mkweaver in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2006, 07:00 PM
  6. what is itemdata equivilent (if exists)
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2006, 03:40 AM
  7. [SOLVED] list property of listbox
    By x taol in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2006, 03:55 PM

Tags for this Thread

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