Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForms
Seem to have a problem with this line:
UserForm1.ListBox1.AddItem .FoundFiles(i) Entire Script: Sub FindFiles() With Application.FileSearch .NewSearch .LookIn = "D:\AllData\APICS" .SearchSubFolders = True .TextorProperty = "APICS Dictionary" .MatchTextExactly = True .Filename = "*.xls" .Execute For i = 1 to .FoundFiles.Count UserForm1.ListBox1.AddItem .FoundFiles(i) next i End With UserForm1.Show End Sub Any ideas? Thanks, mb |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForms
Specifically what problem are you having with the line?
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "mb" wrote in message ... Seem to have a problem with this line: UserForm1.ListBox1.AddItem .FoundFiles(i) Entire Script: Sub FindFiles() With Application.FileSearch .NewSearch .LookIn = "D:\AllData\APICS" .SearchSubFolders = True .TextorProperty = "APICS Dictionary" .MatchTextExactly = True .Filename = "*.xls" .Execute For i = 1 to .FoundFiles.Count UserForm1.ListBox1.AddItem .FoundFiles(i) next i End With UserForm1.Show End Sub Any ideas? Thanks, mb |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForms
Receiving a Run-time error '424': object required.
"Chip Pearson" wrote in message ... Specifically what problem are you having with the line? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "mb" wrote in message ... Seem to have a problem with this line: UserForm1.ListBox1.AddItem .FoundFiles(i) Entire Script: Sub FindFiles() With Application.FileSearch .NewSearch .LookIn = "D:\AllData\APICS" .SearchSubFolders = True .TextorProperty = "APICS Dictionary" .MatchTextExactly = True .Filename = "*.xls" .Execute For i = 1 to .FoundFiles.Count UserForm1.ListBox1.AddItem .FoundFiles(i) next i End With UserForm1.Show End Sub Any ideas? Thanks, mb |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForms
Hello MB, You should check that the .FoundFiles.Count is not zero. If it is I suspect .FoundFiles(i) object returns a Null. The .AddItem method will fail if the item is not a string. Try this... Code: -------------------- Sub FindFiles() With Application.FileSearch .NewSearch .LookIn = "D:\AllData\APICS" .SearchSubFolders = True .TextorProperty = "APICS Dictionary" .MatchTextExactly = True .Filename = "*.xls" .Execute For i = 1 to .FoundFiles.Count If .FoundFiles.Count = 0 Then Exit Sub UserForm1.ListBox1.AddItem .FoundFiles(i) Next i End With UserForm1.Show End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=479954 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with Userforms | Excel Discussion (Misc queries) | |||
Userforms | Excel Programming | |||
Userforms | Excel Programming | |||
Userforms..... | Excel Programming | |||
Userforms | Excel Programming |