+ Reply to Thread
Results 1 to 5 of 5

Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005)':

  1. #1
    Forum Contributor
    Join Date
    11-05-2006
    Posts
    123

    Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005)':

    I've created two listboxes. My objective with the following code is to add listbox1 item to listbox2 when listbox1 item is selected. Then i would like to remove the selected item from listbox1. But i receive an error that i don't understand, and the code that Excel highlights in yellow (indicating a problem) is: ListBox1.RemoveItem r

    There error message reads:
    "Run-time error '-2147467259 (80004005)':
    Unspecified error."


    Please Login or Register  to view this content.
    Last edited by Wedge120; 09-18-2016 at 01:18 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,872

    Re: Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005

    You cannot remove an item while it is selected. Add this line before your RemoveItem:

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    11-05-2006
    Posts
    123

    Re: Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005

    That was the problem..thank you.

    With this new line of code, two items from Listbox1 are being copied to Listbox2: the item selected and the item just below it. After stepping through the code, i realized it was executing twice with the item just below the original item being selected after removing the first.
    This is triggering the Listbox1_Click event a second time? Should i be using the ListBox1_Change event? Not sure what to do here.

  4. #4
    Forum Contributor
    Join Date
    11-05-2006
    Posts
    123

    Re: Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005

    I discovered that using the "DblClick" event evades the problem i am having.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,872

    Re: Listbox remove item yields error: "Unspecified" run-time error '-2147467259 (80004005

    Sorry, I should have thought of that. The general strategy for dealing with this kind of thing, where you do something in your code that will trigger an event, is to use a variable to indicate whether or not the code should respond to the event. Something like this:

    Please Login or Register  to view this content.

+ 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. Run time error'-2147467259(80004005)':
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2014, 12:27 AM
  2. run-time error '-2147467259(80004005)':
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2014, 03:46 AM
  3. [SOLVED] Run-time error '-2147467259(80004005)'
    By Lloyd Blankfein in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-14-2013, 01:52 PM
  4. Excel 2010 Run Time Error '-2147467259 (80004005)'
    By jdpeterson72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 06:52 PM
  5. Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  6. Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  7. [SOLVED] Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM

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