Hi,
I have a query with file names (no extension)
I want to include a function that returns the path to the filename in the specified column.
The path should be a link to the file found
If no file is found nothing should be returned.
Here is the code I have thus far:
' strfilename should be the name of he column in my query which contains the filename to be searched for (no extension should be needed to e specified
Public Function FileLocation(strFileName As Variant) As Variant
Dim varResult As Variant
On Error GoTo End_Function
With Application.FileSearch
.FileName = strFileName
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
varResult = .FoundFiles
End With
FileLocation = varResult
End_Function:
End Function
This Function Returns nothing.
Any help would be greatly appreciated...
Thanks in Advance.
Regards Flo79
I have a query with file names (no extension)
I want to include a function that returns the path to the filename in the specified column.
The path should be a link to the file found
If no file is found nothing should be returned.
Here is the code I have thus far:
' strfilename should be the name of he column in my query which contains the filename to be searched for (no extension should be needed to e specified
Public Function FileLocation(strFileName As Variant) As Variant
Dim varResult As Variant
On Error GoTo End_Function
With Application.FileSearch
.FileName = strFileName
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
varResult = .FoundFiles
End With
FileLocation = varResult
End_Function:
End Function
This Function Returns nothing.
Any help would be greatly appreciated...
Thanks in Advance.
Regards Flo79