Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Application . filesearch doesn't work

Hi,

Has anybody else experienced problems using application.filesearch
My code looks something like this:-

Sub FileListSearch()
Call Clear
Dim searchtext As String, qfile As String: qsearchtext = [G5]
[C6].Select
Do Until IsEmpty(ActiveCell)
qfolder = ActiveCell.Value
qfile = ActiveCell.Offset(1, 0)
With Application.FileSearch
.NewSearch
.LookIn = qfolder
.MatchTextExactly = False
.Filename = qfile
.TextOrProperty = qsearchtext
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
ActiveSheet.Hyperlinks.Add Anchor:=Cells(13 + i,
3), Address:= _
.FoundFiles(i), TextToDisplay:= _
Replace(.FoundFiles(i), qfolder & "\", "")
Next i
End If
End With
ActiveCell.Offset(1, 0).Select
Loop
End Sub

However whenever I search for a specific reference, In my case a cheque
number it appears in some but not all of the workbooks I expected it to
appear in.
Is there something I need to be careful about with the type of data
is qsearchtext to be defined as an integer, or string?
I can see the cheque number in one of the spreadsheets but it doesn't
come outusing vba code.
As well as this I tried a search using XP explorer and no results
either.
Am I missing a trick here?
Has anyone else overcome these problems using .filesearch.

Any help appreciated

thanks

somethinglikeant

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Application . filesearch doesn't work

Excel files are not text files, they are binary files. Numbers are recorded
in binary format, not literal strings. Maybe if you enter the check numbers
in cells as text this might work, but you'd have to be alert to the
possibility of false positives.

--
Jim
"somethinglikeant" wrote in message
oups.com...
| Hi,
|
| Has anybody else experienced problems using application.filesearch
| My code looks something like this:-
|
| Sub FileListSearch()
| Call Clear
| Dim searchtext As String, qfile As String: qsearchtext = [G5]
| [C6].Select
| Do Until IsEmpty(ActiveCell)
| qfolder = ActiveCell.Value
| qfile = ActiveCell.Offset(1, 0)
| With Application.FileSearch
| .NewSearch
| .LookIn = qfolder
| .MatchTextExactly = False
| .Filename = qfile
| .TextOrProperty = qsearchtext
| .SearchSubFolders = False
| .FileType = msoFileTypeExcelWorkbooks
| If .Execute 0 Then
| For i = 1 To .FoundFiles.Count
| ActiveSheet.Hyperlinks.Add Anchor:=Cells(13 + i,
| 3), Address:= _
| .FoundFiles(i), TextToDisplay:= _
| Replace(.FoundFiles(i), qfolder & "\", "")
| Next i
| End If
| End With
| ActiveCell.Offset(1, 0).Select
| Loop
| End Sub
|
| However whenever I search for a specific reference, In my case a cheque
| number it appears in some but not all of the workbooks I expected it to
| appear in.
| Is there something I need to be careful about with the type of data
| is qsearchtext to be defined as an integer, or string?
| I can see the cheque number in one of the spreadsheets but it doesn't
| come outusing vba code.
| As well as this I tried a search using XP explorer and no results
| either.
| Am I missing a trick here?
| Has anyone else overcome these problems using .filesearch.
|
| Any help appreciated
|
| thanks
|
| somethinglikeant
|


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
Application.FileSearch Cleberton(Brazilian) Excel Discussion (Misc queries) 2 October 26th 09 01:21 PM
Application.FileSearch malfunction?????? rznante Excel Programming 2 June 6th 06 04:52 PM
Application.FileSearch challenge Robin Clay[_4_] Excel Programming 3 March 3rd 06 08:56 PM
Application.FileSearch is not working?? alondon Excel Programming 5 January 18th 05 03:12 AM
VBA Application.FileSearch Roger Frye Excel Programming 0 March 5th 04 04:07 AM


All times are GMT +1. The time now is 06:43 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"