Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mb mb is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
mb mb is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Help with Userforms Panagiotis Marantos Excel Discussion (Misc queries) 2 July 25th 06 04:26 PM
Userforms nath Excel Programming 1 May 20th 04 04:53 PM
Userforms Paul Clark Excel Programming 2 January 17th 04 04:51 PM
Userforms..... Candee[_8_] Excel Programming 1 November 27th 03 06:02 PM
Userforms Gary[_8_] Excel Programming 1 August 18th 03 03:26 PM


All times are GMT +1. The time now is 02:06 AM.

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

About Us

"It's about Microsoft Excel"