#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default File Search

GOod day all..

How to do file search?

I had reading some codes in this forum.. But none suit m
application..

I want to search a file(file name is dummy for first time created
whether it exists or not, if not exists, it will create the dummy.txt
if this file name(dummy.txt) exists, it will automatically assig
another name to it, for example, Engine001, and it will search agai
and check whether this file name(Engine001) exist or not. If exist, i
will create another file name, Engine002 .... until the file name i
not exists in the folder, it will use the file name and move on t
store data in the file.

How to do the search for the above application?

Helps from anyone is appreciated~
:

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default File Search

Function FileExists(fname As String) As Boolean
With Application.FileSearch
.LookIn = "C:\ "
.NewSearch
.filename = fname
.Execute

If .FoundFiles.Count = 0 Then
FileExists = False
Else
FileExists = True
End If
End With
End Function



Can anyone help me to check whether the function above correct o
not..? When I debug the code above, whether the file exists or not, th
.FoundFiles.Count is alwaz equal to 0..... Why this happen

--
Message posted from http://www.ExcelForum.com

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
file search or search files Richad Excel Discussion (Misc queries) 0 October 22nd 09 07:56 PM
Search a FAQ file Jane Excel Worksheet Functions 1 October 18th 06 09:07 PM
Turning a text file name into a search and linking the file as a hyperlink AlistairM Excel Discussion (Misc queries) 1 January 26th 06 04:55 AM
File Search Francis Ang Excel Programming 1 May 21st 04 01:44 PM
Macro to search from one file & place on another file. Luong[_2_] Excel Programming 0 May 6th 04 04:53 PM


All times are GMT +1. The time now is 02:27 AM.

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"