B
BrianPaul
I used the Example from http://support.microsoft.com/Default.aspx?id=210613
to list files on a hard drive. I modified the code to suite where my files
were at.
Function LocateFile(strFileName As String)
Dim vItem As Variant
With Application.FileSearch
.FileName = strFileName
.LookIn = "N:\Books\Auto"
.SearchSubFolders = True
.Execute
For Each vItem In .FoundFiles
Debug.Print vItem
Next vItem
End With
End Function
Ran the Code in the immediate window: ?LocateFile("*.*")
Result was:
N:\Books\Auto\An Introduction to Buffing & Polishing.pdf
N:\Books\Auto\Auto Repair for Dummies.pdf
N:\Books\Auto\Automobile Repair Tips.PDF
N:\Books\Auto\Haynes Service And Repair Manual.pdf
N:\Books\Auto\how to hot wire a car correctly.txt
N:\Books\Auto\Small Engine Repair.PDF
N:\Books\Auto\The Haynes Welding Manual.pdf
Okay it worked. It listed the files specified in the path of the function.
MY Question: On a Form I want to Put a Command Button. I can use the same
Syntax: ?LocateFile("*.*") on the event click property. However I would
like it to import the results to my table called Ttest with a field called
FileBookName.
Can it be Done? and How? Read through the articles but couldnt find how to
do it.
Thanks,
BRian
to list files on a hard drive. I modified the code to suite where my files
were at.
Function LocateFile(strFileName As String)
Dim vItem As Variant
With Application.FileSearch
.FileName = strFileName
.LookIn = "N:\Books\Auto"
.SearchSubFolders = True
.Execute
For Each vItem In .FoundFiles
Debug.Print vItem
Next vItem
End With
End Function
Ran the Code in the immediate window: ?LocateFile("*.*")
Result was:
N:\Books\Auto\An Introduction to Buffing & Polishing.pdf
N:\Books\Auto\Auto Repair for Dummies.pdf
N:\Books\Auto\Automobile Repair Tips.PDF
N:\Books\Auto\Haynes Service And Repair Manual.pdf
N:\Books\Auto\how to hot wire a car correctly.txt
N:\Books\Auto\Small Engine Repair.PDF
N:\Books\Auto\The Haynes Welding Manual.pdf
Okay it worked. It listed the files specified in the path of the function.
MY Question: On a Form I want to Put a Command Button. I can use the same
Syntax: ?LocateFile("*.*") on the event click property. However I would
like it to import the results to my table called Ttest with a field called
FileBookName.
Can it be Done? and How? Read through the articles but couldnt find how to
do it.
Thanks,
BRian