Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default filesearch frustration

sub A()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\MY_USERNAME\Desktop"
.Filename = "*.xls"

MsgBox .FoundFiles.Count
End With
end sub


this keeps giving me a "0" but there is indeed a .xls on my desktop.
any help would save my from throwing my computer (not really), but any
help would be great.
thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default filesearch frustration

I think you need a .execute before .foundfiles contains anything.

Sam


"jason" wrote:

sub A()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\MY_USERNAME\Desktop"
.Filename = "*.xls"

MsgBox .FoundFiles.Count
End With
end sub


this keeps giving me a "0" but there is indeed a .xls on my desktop.
any help would save my from throwing my computer (not really), but any
help would be great.
thank you.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default filesearch frustration

I find that FileSearch is very intermittent in whether it works or not. I use
the following instead.

sub A()
Dim strLookIn, fName as String
Dim intFound as Integer
strLookIn = "C:\Documents and Settings\MY_USERNAME\Desktop\"
intFound = 0
fName = Dir$(strLookIn & "*.xls")
Do While fName < ""
intFound = intFound + 1
fName = Dir$
Loop
MsgBox intFound
End Sub

"jason" wrote:

sub A()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\MY_USERNAME\Desktop"
.Filename = "*.xls"

MsgBox .FoundFiles.Count
End With
end sub


this keeps giving me a "0" but there is indeed a .xls on my desktop.
any help would save my from throwing my computer (not really), but any
help would be great.
thank you.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default filesearch frustration

On Nov 19, 11:32*am, Sam Wilson
wrote:
I think you need a .execute before .foundfiles contains anything.

Sam



"jason" wrote:
sub A()
* * With Application.FileSearch
* * * * .NewSearch
* * * * .LookIn = "C:\Documents and Settings\MY_USERNAME\Desktop"
* * * * .Filename = "*.xls"


* * * * MsgBox .FoundFiles.Count
* * End With
end sub


this keeps giving me a "0" but there is indeed a .xls on my desktop.
any help would save my from throwing my computer (not really), but any
help would be great.
thank you.
.


Sam, exactly. thank you!
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
UDF Frustration - Won't Update EricG Excel Programming 3 August 13th 09 03:37 PM
Much frustration... kirkm[_6_] Excel Programming 3 September 19th 06 04:12 AM
Auto_Open Frustration CG[_3_] Excel Programming 1 March 8th 06 02:57 AM
VBA frustration Mark1 Excel Programming 4 October 25th 04 08:04 PM
Commandbar frustration. Julian Cox Excel Programming 6 July 23rd 04 08:57 PM


All times are GMT +1. The time now is 05:50 AM.

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"