Select All in a listbox
Mary:
If you want to do it by means of a 'Select All' button on the form the
code for its Click event procedure would be like this:
Dim n As Integer
Dim ctrl As Control
Set ctrl = Me.YourListBoxName
For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = True
Next n
Similarly, for a 'Clear Selections' button:
Dim n As Integer
Dim ctrl As Control
Set ctrl = Me.YourListBoxName
For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = False
Next n
Ken Sheridan
Stafford, England
On May 9, 1:58 am, sweeneysmsm
wrote:
Is there a way to select all of the records in a listbox instead of having to
select each one individually?
I am using the listbox to send stored e-mail addresses so that a report can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.
Thanks for whatever insight you can provide.
Mary
|