Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Trupti Patil   on Nov 27 In MS Office Category.

  
Question Answered By: Rae Fischer   on Nov 27

I've used the below mentioned code  in an excel solution.
I'm a bit surprised over the speed. It takes about 10 sec. (looong time
to wait) to search through a folder  with 2 subfolders, 640 files  in all.

What I do is:

- pick up cell-value by dbl-click on cell
loop  through folders  for files that starts with cell-value (always 5
car.)
- matches are put in a list box, from where user can pick to open

The For/Each code:

For Each OneFile In F.Files
Debug.Print OneFile.Name
If Left(OneFile.Name, 5) = ActiveCell.EntireRow.Cells(1,
1).Value Then
UserForm1.ListBox1.AddItem OneFile.Path
End If
Next OneFile

A comparable search from explorer takes less than 1 sec.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Loop through folders Or get search suggestion and latest updates.


Tagged: