+ Reply to Thread
Results 1 to 4 of 4

ListBox != Forms.ListBox.1?

  1. #1
    Registered User
    Join Date
    01-02-2013
    Location
    Indiana, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    ListBox != Forms.ListBox.1?

    Why doesn't this work:

    Please Login or Register  to view this content.
    This code generates a "Type Mismatch" error. So instead I try this:

    Please Login or Register  to view this content.
    That code generates an "Invalid Argument" error (-2147024809...)

    I can get a little closer by not declaring the variable lb, like this:

    Please Login or Register  to view this content.
    But then lb is always Null.

    What the heck is going on here?! It seems I can create the ListBox successfully but can't address it after creation?

    Little help?!

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: ListBox != Forms.ListBox.1?

    Please Login or Register  to view this content.
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Registered User
    Join Date
    01-02-2013
    Location
    Indiana, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: ListBox != Forms.ListBox.1?

    Hello, Bishonen

    The code you posted results in lb as a Null object in the Watch window, which is very very strange because I can still assign properties to it and interact with it as if it were an actual ListBox!

    I don't know why it works, but it does and that's good enough for me. Thanks!

    -Brian

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: ListBox != Forms.ListBox.1?

    Brian

    Declare as MSForms.Listbox.
    If posting code please use code tags, see here.

+ 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