LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Filesearch Runny Like a Wiped Dog Phenomenon

Shawn

I've heard people complain about FileSearch in the past, but I don't recall
what specifically the problems were. Whatever it was, I decided then not to
use it and to use Dir or the FileSystemObject instead. There doesn't seem
to be anything that you're doing that you can't do with the Dir function.
You might consider using that instead.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Shawn K Haase" wrote in message
...
How-D!

I got Office XP Developer 2002 SP-2 and Windows XP.

I wrote a little form's based app in Excel that would take
all the filenames from a user choosen directory and dump
them into a worksheet. From there I would copy and paste
the filenames into an email (I manipulate/organize alot of
CAD files and send them off to vendors and I like to send
a filename listing for each email...).

My app worked perfectly up until a month or so ago. Now
it lags for a FEW minutes whenever the
application.filesearch.execute() method is run. Before,
the filenames would plop into the worksheet in a matter of
a second or two.

I can't recall me having run any updates though I can't
vouch for our Sys Admin doing the same after hours.

I have attached the code to this post for the heck of it.
I believe that there is nothing wrong with it since it
used to run flawlessly for ever.

I am curious to now if the FileSearch object uses a
Windows Dll or something to run properly. Maybe this Dll
needs replacing. Who knows???

I had the installation "repaired" today via the Office CDs
but this did not improve the situation...

Maybe it needs Indexing Services turned on or off. Who
Knows???

Any idears????

Thanx,

Shawn K Haase


Private Sub cmdExtractFilenames_Click()

' Will erase ALL content on active page
Cells.Select
Selection.ClearContents

sPath = Application.GetOpenFilename
LastSlashPos = InStrRev(sPath, "\")
sPath = Mid(sPath, 1, LastSlashPos)
Set oSht = ActiveWorkbook.ActiveSheet
nRow = 3
With Application.FileSearch
.NewSearch
.LookIn = sPath
.SearchSubFolders = False
.Filename = "*.*"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
End With
With Application.FileSearch
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Filename = .FoundFiles(i)
Length = Len(Filename)
If frmGetInfo.optHideExtension.Value = True
Then
ExtensionPos = InStrRev(Filename, ".")
Filename = Mid(Filename, 1, ExtensionPos -
1)
End If
LastSlashPos = InStrRev(Filename, "\")
Filename = Mid(Filename, LastSlashPos + 1)
If frmGetInfo.chkUseFileNameFormat.Value =
True Then
Filename = "<Filename: " + Filename + ""
ElseIf frmGetInfo.chkBracketFilename.Value =
True Then
Filename = "<< " + Filename + ""
End If
oSht.Cells(nRow, 2).Value = Filename
nRow = nRow + 1
Next i
Else
MsgBox "There were no files found."
End If
End With


End Sub



 
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
Locking the background so it's not wiped by cut-n-paste Mike Halsey Excel Discussion (Misc queries) 2 January 28th 10 05:20 PM
Curious Phenomenon...Vlookup not matching Eric @ BP-EVV Excel Worksheet Functions 6 August 27th 08 05:14 PM
Need HELP! Excel docs wiped out Paul Excel Discussion (Misc queries) 0 June 23rd 08 03:04 PM
weird phenomenon Cliff Excel Discussion (Misc queries) 0 April 16th 07 07:38 PM
Strange phenomenon with General vs. Text formatting Bob Excel Discussion (Misc queries) 6 November 17th 06 08:02 PM


All times are GMT +1. The time now is 10:56 PM.

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

About Us

"It's about Microsoft Excel"