Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I try to use a multiselection listbox, but receive the error message "Could not get the Selection property. Invalid argument". Any suggestion why? Thank you in advance Frank _____________________ Dim x As Integer Private Sub CommandButton1_Click() ListBox2.Clear For x = 0 To 9 If ListBox1.Selected(x) = True Then ListBox2.AddItem ListBox1.List(x) Next x End Sub Private Sub UserForm_Initialize() Dim myarray() Dim fs As Object Dim tekst As String With UserForm1 .ListBox1.MultiSelect = fmMultiSelectExtended .CommandButton1.Caption = "Show selections" .CommandButton1.AutoSize = True .ListBox2.Clear Set fs = Application.FileSearch With fs .LookIn = "c:\My files\" .SearchSubFolders = True .Filename = "*.xls" If .Execute 0 Then ReDim myarray(fs.FoundFiles.Count) For x = 1 To .FoundFiles.Count myarray(x) = .FoundFiles(x) Next x Else MsgBox "No files found!", vbInformation, "Empty folder" End If For x = 1 To fs.FoundFiles.Count pos1 = InStrRev(myarray(x), "\", , vbTextCompare) tekst = Mid(myarray(x), 1, pos1 - 1) UserForm1.ListBox1.AddItem tekst Next x End With End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
change combobox values one by one based on selection in multiselect listbox | Excel Programming | |||
userform multiselect listbox problem | Excel Programming | |||
Last Selection from MultiSelect Listbox | Excel Programming | |||
Multiselect ListBox - Active/Inactive Items | Excel Programming | |||
Multiselect listbox selection question | Excel Programming |