Searching for a file
Yes the argument pszPath (can be a filename or a path) should be in round
brackets (i.e. to force the return of an explicit value i.e so as not to mask
the return value).
If A1 contains your file name, say, MyFile.XLS AND you want to search in the
path where Excel stores its workbook, you would call
If PathFileExists(application.defaultfilepath & "\" & range("A1").Value)
Then 'do this .. whatever you want
If A1 contains the fully qualified name of a file, e.g c:\my path\myfile.xls
you would do
If PathFileExists(range("A1").Value) Then 'do this .. whatever you want
If A1 contains a file name only (no .XLS) you want to search in c:\my alt
path, you would do
If PathFileExists("c:\my alt path" & "\" & range("A1").Value & ".XLS") Then
'do this ..
I.E the argument is the fully qualified name of the file you want to search
for.
|