Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to clear all items in listbox in VBA?

Posted on 2006-05-12
6
Medium Priority
?
3,953 Views
Last Modified: 2008-01-09
hi
in VBA, how can i remove all items in listbox object?
I don't know number of items.
thanks
0
Comment
Question by:yadafarin
  • 3
4 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 16666309
is it bounded?
if so, set rowsource to ""

e.g. listbox.rowsource = ""
u may need to refresh/requery it

0
 

Author Comment

by:yadafarin
ID: 16666547
no, it hasn't rowsource.
I add items in listbox by VBA code (with .Additems).
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 120 total points
ID: 16666810
   For i = List2.ListCount - 1 To 0 Step -1
        List2.RemoveItem i
    Next i
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16689608
did this work
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question