|
|

How to Find a File on the Computer
If you wish to find the full path to a file on the computer, you can use the FileScriptingObject if you set a reference to it. Alternatively, you can use an API call which will return the first file that matches.
Private Declare Function apiSearchTreeForFile Lib "imagehlp" Alias "SearchTreeForFile" _
(ByVal RootPath As String, _
ByVal InputPathName As String, _
ByVal OutputBuffer As String) As Long
Private Const MAX_PATH = 260
Function fFindFile(strFile As String, Optional varPath As Variant) As String
Dim strReturn As String
Dim lngReturn As Long
If IsMissing(varPath) Then varPath = "C:\"
strReturn = String(MAX_PATH, 0)
lngReturn = apiSearchTreeForFile(varPath, strFile, strReturn)
If lngReturn <> 0 Then
fFindFile = Left(strReturn, InStr(strReturn, Chr(0)) - 1)
End If
End Function
|
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |