Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default FileSearch does not work, XP SVP1, Office 2002

I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If

End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default FileSearch does not work, XP SVP1, Office 2002

Hi wejones

Try it with

.Filename = ".txt"

If it is not working use Dir
If you want a example post back


--
Regards Ron de Bruin
http://www.rondebruin.nl


"wejones" wrote in message ...
I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If

End With

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default FileSearch does not work, XP SVP1, Office 2002

FileSearch is problematic. It doesn't work for me, either; same program
versions that you are using.

On Thu, 18 Nov 2004 11:09:55 -0800, "wejones"
wrote:

I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If

End With

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default FileSearch does not work, XP SVP1, Office 2002

Did not work. This seems to be a specific problem with Office 2002 on my
machine. I have uninstalled office, used the cleanup program and reinstalled
it. But I still have the same problem.

"Ron de Bruin" wrote:

Hi wejones

Try it with

.Filename = ".txt"

If it is not working use Dir
If you want a example post back


--
Regards Ron de Bruin
http://www.rondebruin.nl


"wejones" wrote in message ...
I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If

End With

End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default FileSearch does not work, XP SVP1, Office 2002

Hi

I am running also Office 2002 and it is working for me, but there are problems with
Application.FileSearch

Like i said use Dir, this is always working

Sub test()
Dim txtcount As Long
Dim TheFile As String
Dim MyPath As String
MyPath = "C:\"
ChDir MyPath
TheFile = Dir("*.txt")
txtcount = 0
Do While TheFile < ""
txtcount = txtcount + 1
TheFile = Dir
Loop
MsgBox txtcount
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"wejones" wrote in message ...
Did not work. This seems to be a specific problem with Office 2002 on my
machine. I have uninstalled office, used the cleanup program and reinstalled
it. But I still have the same problem.

"Ron de Bruin" wrote:

Hi wejones

Try it with

.Filename = ".txt"

If it is not working use Dir
If you want a example post back


--
Regards Ron de Bruin
http://www.rondebruin.nl


"wejones" wrote in message ...
I was testing the following filesearch in Excel by creating 3 text files in
the C:\ directory. I keep getting There were no files found. I tried this
on another computer and it worked fine. I tried the code in access, same
result.

Sub filesearchtest()


With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.Filename = "*.txt"
.MatchTextExactly = False
'.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If

End With

End Sub






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
Excel 2002 to 2007 Macro containing "Filesearch" dede Setting up and Configuration of Excel 3 December 4th 09 05:00 PM
Trying to work with files copied from Office 2004 (MAC) in Office rgranell Excel Worksheet Functions 3 June 19th 08 04:31 PM
Unable to open Office 2007 files using Office 2002 XP GildaBB Excel Discussion (Misc queries) 2 July 20th 07 04:08 AM
FileSearch inconsistencies between Office/Windows version combinat Ali Campbell Excel Programming 5 July 8th 04 09:36 PM
Office automation application which will work with any version of office C#.NET Silly Programmer Excel Programming 1 February 21st 04 10:54 AM


All times are GMT +1. The time now is 12:15 PM.

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"