Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Completely Erase ListBox

Hi all,

This seems like a simple question, but I can't find the answer. I have
a user form with a listbox control. I populate this control by setting
the List property to a two-dimensional array. The listbox is populated
based on the user's input into other controls. The same user form also
has a reset button if the user wants to start over.

In the click event of the reset button, I want to do something to
completely clear the listbox of its contents. I've tried using the
clear method, which throws "Unspecified Error". I've tried setting the
List property to a blank two-dimensional array, which throws
"Permission Denied". I've tried looping through the list and using the
RemoveItem method, but that throws "Unspecified Error".

I do have event handlers in the listbox on click event, but the call
doesn't seem to be recursive (is that the right term?). Any ideas?

Thanks,
Johnny

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Completely Erase ListBox

Johnny,

If you have the RowSource specified in the properties window for
the form you can run into that problem.
If you are filling the list with an array then just remove the
RowSource entry in the property window.
Or if you must specify the RowSource, then to clear the list box
just set the RowSource to an empty string...

ListBox1.RowSource = vbNullString
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Johnny"
wrote in message
Hi all,
This seems like a simple question, but I can't find the answer. I have
a user form with a listbox control. I populate this control by setting
the List property to a two-dimensional array. The listbox is populated
based on the user's input into other controls. The same user form also
has a reset button if the user wants to start over.

In the click event of the reset button, I want to do something to
completely clear the listbox of its contents. I've tried using the
clear method, which throws "Unspecified Error". I've tried setting the
List property to a blank two-dimensional array, which throws
"Permission Denied". I've tried looping through the list and using the
RemoveItem method, but that throws "Unspecified Error".

I do have event handlers in the listbox on click event, but the call
doesn't seem to be recursive (is that the right term?). Any ideas?

Thanks,
Johnny

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Completely Erase ListBox

Jim,

I've tried your suggestion and it does not work. I'm not using the
rowsource property of the listbox. I'm setting the List property to an
array.

Thanks,
Johnny

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
want to erase the 0 Darrell_Sarrasin via OfficeKB.com Excel Discussion (Misc queries) 4 September 16th 08 03:24 PM
Erase Key in Legend Carlo Charts and Charting in Excel 5 August 30th 06 05:55 PM
Erase Duplicates John Excel Worksheet Functions 1 December 7th 05 05:16 PM
SELECT, ERASE, EDIT items in listbox unplugs[_29_] Excel Programming 10 June 30th 04 04:56 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"